summaryrefslogtreecommitdiffstats
path: root/lotuswordpro
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /lotuswordpro
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lotuswordpro/CppunitTest_lotuswordpro_import_test.mk38
-rw-r--r--lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk43
-rw-r--r--lotuswordpro/IwyuFilter_lotuswordpro.yaml114
-rw-r--r--lotuswordpro/Library_lwpft.mk212
-rw-r--r--lotuswordpro/Makefile7
-rw-r--r--lotuswordpro/Module_lotuswordpro.mk25
-rw-r--r--lotuswordpro/README1
-rw-r--r--lotuswordpro/inc/localtime.hxx86
-rw-r--r--lotuswordpro/inc/lwpatomholder.hxx88
-rw-r--r--lotuswordpro/inc/lwpbasetype.hxx124
-rw-r--r--lotuswordpro/inc/lwpbookmarkmgr.hxx87
-rw-r--r--lotuswordpro/inc/lwpchangemgr.hxx91
-rw-r--r--lotuswordpro/inc/lwpcolor.hxx124
-rw-r--r--lotuswordpro/inc/lwpdefs.hxx211
-rw-r--r--lotuswordpro/inc/lwpdocdata.hxx182
-rw-r--r--lotuswordpro/inc/lwpdropcapmgr.hxx78
-rw-r--r--lotuswordpro/inc/lwpfilehdr.hxx91
-rw-r--r--lotuswordpro/inc/lwpfont.hxx289
-rw-r--r--lotuswordpro/inc/lwpfoundry.hxx305
-rw-r--r--lotuswordpro/inc/lwpfrib.hxx137
-rw-r--r--lotuswordpro/inc/lwpglobalmgr.hxx103
-rw-r--r--lotuswordpro/inc/lwpidxmgr.hxx113
-rw-r--r--lotuswordpro/inc/lwpobj.hxx140
-rw-r--r--lotuswordpro/inc/lwpobjfactory.hxx121
-rw-r--r--lotuswordpro/inc/lwpobjhdr.hxx136
-rw-r--r--lotuswordpro/inc/lwpobjid.hxx143
-rw-r--r--lotuswordpro/inc/lwpobjstrm.hxx127
-rw-r--r--lotuswordpro/inc/lwpobjtags.hxx237
-rw-r--r--lotuswordpro/inc/lwpoverride.hxx483
-rw-r--r--lotuswordpro/inc/lwpsvstream.hxx104
-rw-r--r--lotuswordpro/inc/lwptools.hxx151
-rw-r--r--lotuswordpro/inc/pch/precompiled_lwpft.cxx12
-rw-r--r--lotuswordpro/inc/pch/precompiled_lwpft.hxx88
-rw-r--r--lotuswordpro/inc/xfilter/ixfattrlist.hxx88
-rw-r--r--lotuswordpro/inc/xfilter/ixfstream.hxx111
-rw-r--r--lotuswordpro/inc/xfilter/ixfstyle.hxx115
-rw-r--r--lotuswordpro/inc/xfilter/xfannotation.hxx108
-rw-r--r--lotuswordpro/inc/xfilter/xfarrowstyle.hxx129
-rw-r--r--lotuswordpro/inc/xfilter/xfbgimage.hxx153
-rw-r--r--lotuswordpro/inc/xfilter/xfbookmark.hxx132
-rw-r--r--lotuswordpro/inc/xfilter/xfborders.hxx190
-rw-r--r--lotuswordpro/inc/xfilter/xfbreaks.hxx136
-rw-r--r--lotuswordpro/inc/xfilter/xfcell.hxx194
-rw-r--r--lotuswordpro/inc/xfilter/xfcellstyle.hxx162
-rw-r--r--lotuswordpro/inc/xfilter/xfchange.hxx123
-rw-r--r--lotuswordpro/inc/xfilter/xfcolor.hxx114
-rw-r--r--lotuswordpro/inc/xfilter/xfcolstyle.hxx109
-rw-r--r--lotuswordpro/inc/xfilter/xfcolumns.hxx156
-rw-r--r--lotuswordpro/inc/xfilter/xfconfigmanager.hxx109
-rw-r--r--lotuswordpro/inc/xfilter/xfcontent.hxx124
-rw-r--r--lotuswordpro/inc/xfilter/xfcontentcontainer.hxx140
-rw-r--r--lotuswordpro/inc/xfilter/xfcrossref.hxx107
-rw-r--r--lotuswordpro/inc/xfilter/xfdate.hxx96
-rw-r--r--lotuswordpro/inc/xfilter/xfdatestyle.hxx204
-rw-r--r--lotuswordpro/inc/xfilter/xfdefs.hxx498
-rw-r--r--lotuswordpro/inc/xfilter/xfdocfield.hxx197
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawgroup.hxx116
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawline.hxx110
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawlinestyle.hxx215
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawobj.hxx107
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawpath.hxx140
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawpolygon.hxx79
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawpolyline.hxx87
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawrect.hxx88
-rw-r--r--lotuswordpro/inc/xfilter/xfdrawstyle.hxx152
-rw-r--r--lotuswordpro/inc/xfilter/xfdropcap.hxx149
-rw-r--r--lotuswordpro/inc/xfilter/xfendnote.hxx116
-rw-r--r--lotuswordpro/inc/xfilter/xfendnoteconfig.hxx81
-rw-r--r--lotuswordpro/inc/xfilter/xfentry.hxx128
-rw-r--r--lotuswordpro/inc/xfilter/xffloatframe.hxx90
-rw-r--r--lotuswordpro/inc/xfilter/xffont.hxx418
-rw-r--r--lotuswordpro/inc/xfilter/xffontdecl.hxx93
-rw-r--r--lotuswordpro/inc/xfilter/xffontfactory.hxx104
-rw-r--r--lotuswordpro/inc/xfilter/xffooter.hxx88
-rw-r--r--lotuswordpro/inc/xfilter/xffooterstyle.hxx85
-rw-r--r--lotuswordpro/inc/xfilter/xffootnote.hxx117
-rw-r--r--lotuswordpro/inc/xfilter/xffootnoteconfig.hxx225
-rw-r--r--lotuswordpro/inc/xfilter/xfframe.hxx251
-rw-r--r--lotuswordpro/inc/xfilter/xfframestyle.hxx236
-rw-r--r--lotuswordpro/inc/xfilter/xfglobal.hxx135
-rw-r--r--lotuswordpro/inc/xfilter/xfheader.hxx86
-rw-r--r--lotuswordpro/inc/xfilter/xfheaderstyle.hxx137
-rw-r--r--lotuswordpro/inc/xfilter/xfhyperlink.hxx128
-rw-r--r--lotuswordpro/inc/xfilter/xfimage.hxx98
-rw-r--r--lotuswordpro/inc/xfilter/xfimagestyle.hxx107
-rw-r--r--lotuswordpro/inc/xfilter/xfindex.hxx229
-rw-r--r--lotuswordpro/inc/xfilter/xfinputlist.hxx113
-rw-r--r--lotuswordpro/inc/xfilter/xflinebreak.hxx82
-rw-r--r--lotuswordpro/inc/xfilter/xflineheight.hxx171
-rw-r--r--lotuswordpro/inc/xfilter/xflinenumberconfig.hxx173
-rw-r--r--lotuswordpro/inc/xfilter/xflist.hxx111
-rw-r--r--lotuswordpro/inc/xfilter/xflistitem.hxx113
-rw-r--r--lotuswordpro/inc/xfilter/xfliststyle.hxx260
-rw-r--r--lotuswordpro/inc/xfilter/xfmargins.hxx131
-rw-r--r--lotuswordpro/inc/xfilter/xfmasterpage.hxx90
-rw-r--r--lotuswordpro/inc/xfilter/xfnumberstyle.hxx153
-rw-r--r--lotuswordpro/inc/xfilter/xfnumfmt.hxx150
-rw-r--r--lotuswordpro/inc/xfilter/xfofficemeta.hxx93
-rw-r--r--lotuswordpro/inc/xfilter/xfpadding.hxx207
-rw-r--r--lotuswordpro/inc/xfilter/xfpagecount.hxx86
-rw-r--r--lotuswordpro/inc/xfilter/xfpagemaster.hxx159
-rw-r--r--lotuswordpro/inc/xfilter/xfpagenumber.hxx98
-rw-r--r--lotuswordpro/inc/xfilter/xfparagraph.hxx89
-rw-r--r--lotuswordpro/inc/xfilter/xfparastyle.hxx301
-rw-r--r--lotuswordpro/inc/xfilter/xfplaceholder.hxx142
-rw-r--r--lotuswordpro/inc/xfilter/xfpoint.hxx104
-rw-r--r--lotuswordpro/inc/xfilter/xfrect.hxx138
-rw-r--r--lotuswordpro/inc/xfilter/xfrow.hxx136
-rw-r--r--lotuswordpro/inc/xfilter/xfrowstyle.hxx114
-rw-r--r--lotuswordpro/inc/xfilter/xfruby.hxx112
-rw-r--r--lotuswordpro/inc/xfilter/xfrubystyle.hxx144
-rw-r--r--lotuswordpro/inc/xfilter/xfsaxstream.hxx120
-rw-r--r--lotuswordpro/inc/xfilter/xfsection.hxx88
-rw-r--r--lotuswordpro/inc/xfilter/xfsectionstyle.hxx99
-rw-r--r--lotuswordpro/inc/xfilter/xfshadow.hxx150
-rw-r--r--lotuswordpro/inc/xfilter/xfstyle.hxx119
-rw-r--r--lotuswordpro/inc/xfilter/xfstylecont.hxx150
-rw-r--r--lotuswordpro/inc/xfilter/xfstylemanager.hxx140
-rw-r--r--lotuswordpro/inc/xfilter/xftable.hxx138
-rw-r--r--lotuswordpro/inc/xfilter/xftablestyle.hxx134
-rw-r--r--lotuswordpro/inc/xfilter/xftabstop.hxx82
-rw-r--r--lotuswordpro/inc/xfilter/xftextboxstyle.hxx82
-rw-r--r--lotuswordpro/inc/xfilter/xftextcontent.hxx93
-rw-r--r--lotuswordpro/inc/xfilter/xftextspan.hxx103
-rw-r--r--lotuswordpro/inc/xfilter/xftextstyle.hxx105
-rw-r--r--lotuswordpro/inc/xfilter/xftimestyle.hxx195
-rw-r--r--lotuswordpro/inc/xfilter/xfutil.hxx95
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/A14.lwpbin0 -> 82280 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwpbin0 -> 32456 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwpbin0 -> 5417924 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/loop-1.lwpbin0 -> 24085 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/loop-2.lwpbin0 -> 79446 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/null-1.lwpbin0 -> 15952 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/null-2.lwpbin0 -> 22368 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwpbin0 -> 21427 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwpbin0 -> 21428 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-1.lwpbin0 -> 15975 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-2.lwpbin0 -> 15952 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-3.lwpbin0 -> 56354 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-4.lwpbin0 -> 15012 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-5.lwpbin0 -> 21428 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/reference-1.lwpbin0 -> 17632 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/reference-2.lwpbin0 -> 82326 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/reference-3.lwpbin0 -> 62632 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/registered-1.lwpbin0 -> 15012 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/stack-1.lwpbin0 -> 6074 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/subtable-1.lwpbin0 -> 83439 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/indeterminate/.gitignore0
-rw-r--r--lotuswordpro/qa/cppunit/data/paragraphProperties.lwpbin0 -> 23172 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwpbin0 -> 5417924 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwpbin0 -> 82280 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/null-1.lwpbin0 -> 17632 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwpbin0 -> 21432 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwpbin0 -> 21429 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwpbin0 -> 29964 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwpbin0 -> 1173532 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/pass/wordpro.lwpbin0 -> 23172 bytes
-rw-r--r--lotuswordpro/qa/cppunit/data/tdf129993.lwpbin0 -> 26152 bytes
-rw-r--r--lotuswordpro/qa/cppunit/import_test.cxx233
-rw-r--r--lotuswordpro/qa/cppunit/test_lotuswordpro.cxx73
-rw-r--r--lotuswordpro/source/filter/LotusWordProImportFilter.cxx166
-rw-r--r--lotuswordpro/source/filter/LotusWordProImportFilter.hxx78
-rw-r--r--lotuswordpro/source/filter/bencont.cxx332
-rw-r--r--lotuswordpro/source/filter/benlist.cxx119
-rw-r--r--lotuswordpro/source/filter/benname.cxx79
-rw-r--r--lotuswordpro/source/filter/benobj.cxx80
-rw-r--r--lotuswordpro/source/filter/bento.hxx378
-rw-r--r--lotuswordpro/source/filter/bentoid.hxx95
-rw-r--r--lotuswordpro/source/filter/benval.cxx137
-rw-r--r--lotuswordpro/source/filter/clone.hxx71
-rw-r--r--lotuswordpro/source/filter/explode.cxx509
-rw-r--r--lotuswordpro/source/filter/explode.hxx123
-rw-r--r--lotuswordpro/source/filter/first.hxx76
-rw-r--r--lotuswordpro/source/filter/localtime.cxx187
-rw-r--r--lotuswordpro/source/filter/lwp9reader.cxx218
-rw-r--r--lotuswordpro/source/filter/lwp9reader.hxx87
-rw-r--r--lotuswordpro/source/filter/lwparrowstyles.hxx103
-rw-r--r--lotuswordpro/source/filter/lwpatomholder.cxx105
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundoverride.cxx23
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundoverride.hxx97
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundstuff.cxx164
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundstuff.hxx95
-rw-r--r--lotuswordpro/source/filter/lwpbasetype.cxx97
-rw-r--r--lotuswordpro/source/filter/lwpbookmarkmgr.cxx107
-rw-r--r--lotuswordpro/source/filter/lwpborderstuff.cxx214
-rw-r--r--lotuswordpro/source/filter/lwpborderstuff.hxx115
-rw-r--r--lotuswordpro/source/filter/lwpbreaksoverride.cxx281
-rw-r--r--lotuswordpro/source/filter/lwpbreaksoverride.hxx239
-rw-r--r--lotuswordpro/source/filter/lwpbulletstylemgr.cxx308
-rw-r--r--lotuswordpro/source/filter/lwpbulletstylemgr.hxx115
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.cxx934
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.hxx209
-rw-r--r--lotuswordpro/source/filter/lwpchangemgr.cxx187
-rw-r--r--lotuswordpro/source/filter/lwpcharacterstyle.cxx179
-rw-r--r--lotuswordpro/source/filter/lwpcharacterstyle.hxx137
-rw-r--r--lotuswordpro/source/filter/lwpcharborderoverride.cxx108
-rw-r--r--lotuswordpro/source/filter/lwpcharborderoverride.hxx99
-rw-r--r--lotuswordpro/source/filter/lwpcharsetmgr.cxx113
-rw-r--r--lotuswordpro/source/filter/lwpcharsetmgr.hxx86
-rw-r--r--lotuswordpro/source/filter/lwpcolor.cxx135
-rw-r--r--lotuswordpro/source/filter/lwpcontent.cxx157
-rw-r--r--lotuswordpro/source/filter/lwpcontent.hxx155
-rw-r--r--lotuswordpro/source/filter/lwpdivinfo.cxx176
-rw-r--r--lotuswordpro/source/filter/lwpdivinfo.hxx157
-rw-r--r--lotuswordpro/source/filter/lwpdivopts.cxx141
-rw-r--r--lotuswordpro/source/filter/lwpdivopts.hxx116
-rw-r--r--lotuswordpro/source/filter/lwpdlvlist.cxx180
-rw-r--r--lotuswordpro/source/filter/lwpdlvlist.hxx159
-rw-r--r--lotuswordpro/source/filter/lwpdoc.cxx830
-rw-r--r--lotuswordpro/source/filter/lwpdoc.hxx230
-rw-r--r--lotuswordpro/source/filter/lwpdocdata.cxx325
-rw-r--r--lotuswordpro/source/filter/lwpdrawobj.cxx1489
-rw-r--r--lotuswordpro/source/filter/lwpdrawobj.hxx376
-rw-r--r--lotuswordpro/source/filter/lwpdropcapmgr.cxx77
-rw-r--r--lotuswordpro/source/filter/lwpfilehdr.cxx86
-rw-r--r--lotuswordpro/source/filter/lwpfilter.cxx223
-rw-r--r--lotuswordpro/source/filter/lwpfilter.hxx69
-rw-r--r--lotuswordpro/source/filter/lwpfnlayout.cxx396
-rw-r--r--lotuswordpro/source/filter/lwpfnlayout.hxx196
-rw-r--r--lotuswordpro/source/filter/lwpfont.cxx511
-rw-r--r--lotuswordpro/source/filter/lwpfootnote.cxx554
-rw-r--r--lotuswordpro/source/filter/lwpfootnote.hxx279
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx534
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx1279
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.hxx235
-rw-r--r--lotuswordpro/source/filter/lwpfrib.cxx468
-rw-r--r--lotuswordpro/source/filter/lwpfribbreaks.cxx157
-rw-r--r--lotuswordpro/source/filter/lwpfribbreaks.hxx101
-rw-r--r--lotuswordpro/source/filter/lwpfribframe.cxx245
-rw-r--r--lotuswordpro/source/filter/lwpfribframe.hxx95
-rw-r--r--lotuswordpro/source/filter/lwpfribheader.hxx124
-rw-r--r--lotuswordpro/source/filter/lwpfribmark.cxx1430
-rw-r--r--lotuswordpro/source/filter/lwpfribmark.hxx156
-rw-r--r--lotuswordpro/source/filter/lwpfribptr.cxx600
-rw-r--r--lotuswordpro/source/filter/lwpfribptr.hxx95
-rw-r--r--lotuswordpro/source/filter/lwpfribsection.cxx454
-rw-r--r--lotuswordpro/source/filter/lwpfribsection.hxx126
-rw-r--r--lotuswordpro/source/filter/lwpfribtable.cxx177
-rw-r--r--lotuswordpro/source/filter/lwpfribtable.hxx75
-rw-r--r--lotuswordpro/source/filter/lwpfribtext.cxx481
-rw-r--r--lotuswordpro/source/filter/lwpfribtext.hxx211
-rw-r--r--lotuswordpro/source/filter/lwpglobalmgr.cxx133
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx693
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.hxx131
-rw-r--r--lotuswordpro/source/filter/lwpholder.cxx117
-rw-r--r--lotuswordpro/source/filter/lwpholder.hxx131
-rw-r--r--lotuswordpro/source/filter/lwphyperlinkmgr.cxx77
-rw-r--r--lotuswordpro/source/filter/lwphyperlinkmgr.hxx83
-rw-r--r--lotuswordpro/source/filter/lwpidxmgr.cxx326
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx2145
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx512
-rw-r--r--lotuswordpro/source/filter/lwplayoutdef.hxx173
-rw-r--r--lotuswordpro/source/filter/lwplaypiece.cxx449
-rw-r--r--lotuswordpro/source/filter/lwplaypiece.hxx368
-rw-r--r--lotuswordpro/source/filter/lwplnopts.cxx99
-rw-r--r--lotuswordpro/source/filter/lwplnopts.hxx94
-rw-r--r--lotuswordpro/source/filter/lwpmargins.hxx108
-rw-r--r--lotuswordpro/source/filter/lwpmarker.cxx538
-rw-r--r--lotuswordpro/source/filter/lwpmarker.hxx265
-rw-r--r--lotuswordpro/source/filter/lwpnotes.cxx324
-rw-r--r--lotuswordpro/source/filter/lwpnotes.hxx157
-rw-r--r--lotuswordpro/source/filter/lwpnumberingoverride.cxx101
-rw-r--r--lotuswordpro/source/filter/lwpnumberingoverride.hxx113
-rw-r--r--lotuswordpro/source/filter/lwpnumericfmt.cxx466
-rw-r--r--lotuswordpro/source/filter/lwpnumericfmt.hxx305
-rw-r--r--lotuswordpro/source/filter/lwpobj.cxx111
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.cxx727
-rw-r--r--lotuswordpro/source/filter/lwpobjhdr.cxx199
-rw-r--r--lotuswordpro/source/filter/lwpobjid.cxx201
-rw-r--r--lotuswordpro/source/filter/lwpobjstrm.cxx380
-rw-r--r--lotuswordpro/source/filter/lwpoleobject.cxx266
-rw-r--r--lotuswordpro/source/filter/lwpoleobject.hxx127
-rw-r--r--lotuswordpro/source/filter/lwpoverride.cxx608
-rw-r--r--lotuswordpro/source/filter/lwppagehint.cxx122
-rw-r--r--lotuswordpro/source/filter/lwppagehint.hxx125
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx1062
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.hxx161
-rw-r--r--lotuswordpro/source/filter/lwppara.cxx866
-rw-r--r--lotuswordpro/source/filter/lwppara.hxx360
-rw-r--r--lotuswordpro/source/filter/lwppara1.cxx602
-rw-r--r--lotuswordpro/source/filter/lwpparaborderoverride.cxx389
-rw-r--r--lotuswordpro/source/filter/lwpparaborderoverride.hxx283
-rw-r--r--lotuswordpro/source/filter/lwpparaproperty.cxx269
-rw-r--r--lotuswordpro/source/filter/lwpparaproperty.hxx272
-rw-r--r--lotuswordpro/source/filter/lwpparastyle.cxx748
-rw-r--r--lotuswordpro/source/filter/lwpparastyle.hxx121
-rw-r--r--lotuswordpro/source/filter/lwppiece.hxx223
-rw-r--r--lotuswordpro/source/filter/lwpproplist.cxx144
-rw-r--r--lotuswordpro/source/filter/lwpproplist.hxx97
-rw-r--r--lotuswordpro/source/filter/lwpprtinfo.cxx98
-rw-r--r--lotuswordpro/source/filter/lwpprtinfo.hxx79
-rw-r--r--lotuswordpro/source/filter/lwppttntbl.hxx145
-rw-r--r--lotuswordpro/source/filter/lwpresource.hxx68
-rw-r--r--lotuswordpro/source/filter/lwprowlayout.cxx500
-rw-r--r--lotuswordpro/source/filter/lwprowlayout.hxx131
-rw-r--r--lotuswordpro/source/filter/lwpsdwdrawheader.hxx354
-rw-r--r--lotuswordpro/source/filter/lwpsdwfileloader.cxx101
-rw-r--r--lotuswordpro/source/filter/lwpsdwfileloader.hxx86
-rw-r--r--lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx413
-rw-r--r--lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx92
-rw-r--r--lotuswordpro/source/filter/lwpsdwrect.cxx176
-rw-r--r--lotuswordpro/source/filter/lwpsdwrect.hxx123
-rw-r--r--lotuswordpro/source/filter/lwpsection.cxx157
-rw-r--r--lotuswordpro/source/filter/lwpsection.hxx139
-rw-r--r--lotuswordpro/source/filter/lwpshadow.hxx109
-rw-r--r--lotuswordpro/source/filter/lwpsilverbullet.cxx448
-rw-r--r--lotuswordpro/source/filter/lwpsilverbullet.hxx162
-rw-r--r--lotuswordpro/source/filter/lwpsortopt.cxx89
-rw-r--r--lotuswordpro/source/filter/lwpsortopt.hxx98
-rw-r--r--lotuswordpro/source/filter/lwpstory.cxx475
-rw-r--r--lotuswordpro/source/filter/lwpstory.hxx175
-rw-r--r--lotuswordpro/source/filter/lwpstyledef.hxx258
-rw-r--r--lotuswordpro/source/filter/lwpsvstream.cxx126
-rw-r--r--lotuswordpro/source/filter/lwptable.cxx228
-rw-r--r--lotuswordpro/source/filter/lwptable.hxx187
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx1577
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.hxx283
-rw-r--r--lotuswordpro/source/filter/lwptaboverride.cxx23
-rw-r--r--lotuswordpro/source/filter/lwptaboverride.hxx116
-rw-r--r--lotuswordpro/source/filter/lwptabrack.cxx135
-rw-r--r--lotuswordpro/source/filter/lwptabrack.hxx146
-rw-r--r--lotuswordpro/source/filter/lwptblcell.cxx262
-rw-r--r--lotuswordpro/source/filter/lwptblcell.hxx340
-rw-r--r--lotuswordpro/source/filter/lwptblformula.cxx580
-rw-r--r--lotuswordpro/source/filter/lwptblformula.hxx223
-rw-r--r--lotuswordpro/source/filter/lwptoc.cxx475
-rw-r--r--lotuswordpro/source/filter/lwptoc.hxx167
-rw-r--r--lotuswordpro/source/filter/lwptools.cxx849
-rw-r--r--lotuswordpro/source/filter/lwpuidoc.cxx129
-rw-r--r--lotuswordpro/source/filter/lwpuidoc.hxx152
-rw-r--r--lotuswordpro/source/filter/lwpusewhen.hxx169
-rw-r--r--lotuswordpro/source/filter/lwpusrdicts.cxx84
-rw-r--r--lotuswordpro/source/filter/lwpusrdicts.hxx77
-rw-r--r--lotuswordpro/source/filter/lwpverdocument.cxx106
-rw-r--r--lotuswordpro/source/filter/lwpverdocument.hxx84
-rw-r--r--lotuswordpro/source/filter/lwpvpointer.cxx84
-rw-r--r--lotuswordpro/source/filter/lwpvpointer.hxx82
-rw-r--r--lotuswordpro/source/filter/tocread.cxx517
-rw-r--r--lotuswordpro/source/filter/tocread.hxx98
-rw-r--r--lotuswordpro/source/filter/ut.hxx75
-rw-r--r--lotuswordpro/source/filter/utbenvs.cxx140
-rw-r--r--lotuswordpro/source/filter/utlist.cxx125
-rw-r--r--lotuswordpro/source/filter/utlist.hxx120
-rw-r--r--lotuswordpro/source/filter/xfilter/xfbase64.cxx133
-rw-r--r--lotuswordpro/source/filter/xfilter/xfbase64.hxx82
-rw-r--r--lotuswordpro/source/filter/xfilter/xfbgimage.cxx162
-rw-r--r--lotuswordpro/source/filter/xfilter/xfborders.cxx366
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcell.cxx197
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcellstyle.cxx245
-rw-r--r--lotuswordpro/source/filter/xfilter/xfchange.cxx148
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcolor.cxx89
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcolstyle.cxx94
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcolumns.cxx181
-rw-r--r--lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx98
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx157
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcrossref.cxx109
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdate.cxx110
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdatestyle.cxx189
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdocfield.cxx234
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx97
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx143
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawline.cxx124
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx120
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawobj.cxx130
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawpath.cxx155
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx99
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx128
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawrect.cxx79
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx318
-rw-r--r--lotuswordpro/source/filter/xfilter/xfentry.cxx106
-rw-r--r--lotuswordpro/source/filter/xfilter/xffloatframe.cxx85
-rw-r--r--lotuswordpro/source/filter/xfilter/xffont.cxx315
-rw-r--r--lotuswordpro/source/filter/xfilter/xffontdecl.cxx68
-rw-r--r--lotuswordpro/source/filter/xfilter/xffontfactory.cxx85
-rw-r--r--lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx121
-rw-r--r--lotuswordpro/source/filter/xfilter/xfframe.cxx202
-rw-r--r--lotuswordpro/source/filter/xfilter/xfframestyle.cxx199
-rw-r--r--lotuswordpro/source/filter/xfilter/xfglobal.cxx132
-rw-r--r--lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx166
-rw-r--r--lotuswordpro/source/filter/xfilter/xfimage.cxx147
-rw-r--r--lotuswordpro/source/filter/xfilter/xfimagestyle.cxx177
-rw-r--r--lotuswordpro/source/filter/xfilter/xfindex.cxx331
-rw-r--r--lotuswordpro/source/filter/xfilter/xflist.cxx99
-rw-r--r--lotuswordpro/source/filter/xfilter/xfliststyle.cxx290
-rw-r--r--lotuswordpro/source/filter/xfilter/xfmargins.cxx119
-rw-r--r--lotuswordpro/source/filter/xfilter/xfmasterpage.cxx101
-rw-r--r--lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx356
-rw-r--r--lotuswordpro/source/filter/xfilter/xfofficemeta.cxx138
-rw-r--r--lotuswordpro/source/filter/xfilter/xfpagemaster.cxx265
-rw-r--r--lotuswordpro/source/filter/xfilter/xfparagraph.cxx108
-rw-r--r--lotuswordpro/source/filter/xfilter/xfparastyle.cxx461
-rw-r--r--lotuswordpro/source/filter/xfilter/xfrow.cxx134
-rw-r--r--lotuswordpro/source/filter/xfilter/xfrowstyle.cxx101
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx86
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx90
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsaxstream.cxx129
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsection.cxx102
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx133
-rw-r--r--lotuswordpro/source/filter/xfilter/xfshadow.cxx116
-rw-r--r--lotuswordpro/source/filter/xfilter/xfstyle.cxx99
-rw-r--r--lotuswordpro/source/filter/xfilter/xfstylecont.cxx251
-rw-r--r--lotuswordpro/source/filter/xfilter/xfstylemanager.cxx375
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.cxx246
-rw-r--r--lotuswordpro/source/filter/xfilter/xftablestyle.cxx130
-rw-r--r--lotuswordpro/source/filter/xfilter/xftabstyle.cxx101
-rw-r--r--lotuswordpro/source/filter/xfilter/xftabstyle.hxx117
-rw-r--r--lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx105
-rw-r--r--lotuswordpro/source/filter/xfilter/xftextcontent.cxx115
-rw-r--r--lotuswordpro/source/filter/xfilter/xftextspan.cxx150
-rw-r--r--lotuswordpro/source/filter/xfilter/xftextstyle.cxx137
-rw-r--r--lotuswordpro/source/filter/xfilter/xftimestyle.cxx150
-rw-r--r--lotuswordpro/source/filter/xfilter/xfutil.cxx447
-rw-r--r--lotuswordpro/util/lwpfilter.component9
413 files changed, 78547 insertions, 0 deletions
diff --git a/lotuswordpro/CppunitTest_lotuswordpro_import_test.mk b/lotuswordpro/CppunitTest_lotuswordpro_import_test.mk
new file mode 100644
index 000000000..315fea09a
--- /dev/null
+++ b/lotuswordpro/CppunitTest_lotuswordpro_import_test.mk
@@ -0,0 +1,38 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,lotuswordpro_import_test))
+
+$(eval $(call gb_CppunitTest_use_external,lotuswordpro_import_test,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,lotuswordpro_import_test, \
+ lotuswordpro/qa/cppunit/import_test \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,lotuswordpro_import_test, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ test \
+ tl \
+ unotest \
+ vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,lotuswordpro_import_test))
+
+$(eval $(call gb_CppunitTest_use_ure,lotuswordpro_import_test))
+$(eval $(call gb_CppunitTest_use_vcl,lotuswordpro_import_test))
+
+$(eval $(call gb_CppunitTest_use_rdb,lotuswordpro_import_test,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,lotuswordpro_import_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
new file mode 100644
index 000000000..3e45405d5
--- /dev/null
+++ b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
@@ -0,0 +1,43 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,lotuswordpro_test_lotuswordpro))
+
+$(eval $(call gb_CppunitTest_use_external,lotuswordpro_test_lotuswordpro,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,lotuswordpro_test_lotuswordpro, \
+ lotuswordpro/qa/cppunit/test_lotuswordpro \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,lotuswordpro_test_lotuswordpro, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ test \
+ unotest \
+ vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,lotuswordpro_test_lotuswordpro))
+
+$(eval $(call gb_CppunitTest_use_ure,lotuswordpro_test_lotuswordpro))
+$(eval $(call gb_CppunitTest_use_vcl,lotuswordpro_test_lotuswordpro))
+
+$(eval $(call gb_CppunitTest_use_components,lotuswordpro_test_lotuswordpro,\
+ configmgr/source/configmgr \
+ i18npool/util/i18npool \
+ lotuswordpro/util/lwpfilter \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,lotuswordpro_test_lotuswordpro))
+
+# vim: set noet sw=4 ts=4:
diff --git a/lotuswordpro/IwyuFilter_lotuswordpro.yaml b/lotuswordpro/IwyuFilter_lotuswordpro.yaml
new file mode 100644
index 000000000..fc8feffb2
--- /dev/null
+++ b/lotuswordpro/IwyuFilter_lotuswordpro.yaml
@@ -0,0 +1,114 @@
+---
+assumeFilename: lotuswordpro/source/filter/lwplayout.cxx
+blacklist:
+ lotuswordpro/inc/lwpatomholder.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpbasetype.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpcolor.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpbookmarkmgr.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpfont.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpidxmgr.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpfoundry.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpchangemgr.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpfrib.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpdocdata.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpobj.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpobjfactory.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpglobalmgr.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpsvstream.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpobjstrm.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpobjid.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwpobjhdr.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/inc/lwptools.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwp9reader.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpbulletstylemgr.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpcontent.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpdivinfo.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpdivopts.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpdoc.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwplayout.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpgrfobj.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwppara.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwprowlayout.hxx:
+ # Complete type is needed for dynamic_cast
+ - lwptablelayout.hxx
+ lotuswordpro/source/filter/lwpsdwdrawheader.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpsdwfileloader.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpsdwrect.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpsortopt.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpsilverbullet.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpuidoc.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpusewhen.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
+ lotuswordpro/source/filter/lwpusrdicts.hxx:
+ # Needed for MPL subset
+ - config_lgpl.h
diff --git a/lotuswordpro/Library_lwpft.mk b/lotuswordpro/Library_lwpft.mk
new file mode 100644
index 000000000..f35568d36
--- /dev/null
+++ b/lotuswordpro/Library_lwpft.mk
@@ -0,0 +1,212 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,lwpft))
+
+$(eval $(call gb_Library_use_sdk_api,lwpft))
+
+$(eval $(call gb_Library_set_include,lwpft, \
+ $$(INCLUDE) \
+ -I$(SRCDIR)/lotuswordpro/inc \
+))
+
+$(eval $(call gb_Library_set_precompiled_header,lwpft,lotuswordpro/inc/pch/precompiled_lwpft))
+
+$(eval $(call gb_Library_use_libraries,lwpft,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ salhelper \
+ i18nlangtag \
+ sfx \
+ sot \
+ svt \
+ svxcore \
+ tl \
+ ucbhelper \
+ vcl \
+ xo \
+))
+
+$(eval $(call gb_Library_use_externals,lwpft,\
+ boost_headers \
+ icui18n \
+ icuuc \
+ icu_headers \
+))
+
+$(eval $(call gb_Library_set_componentfile,lwpft,lotuswordpro/util/lwpfilter))
+
+$(eval $(call gb_Library_add_exception_objects,lwpft,\
+ lotuswordpro/source/filter/bencont \
+ lotuswordpro/source/filter/benlist \
+ lotuswordpro/source/filter/benname \
+ lotuswordpro/source/filter/benobj \
+ lotuswordpro/source/filter/benval \
+ lotuswordpro/source/filter/explode \
+ lotuswordpro/source/filter/localtime \
+ lotuswordpro/source/filter/LotusWordProImportFilter \
+ lotuswordpro/source/filter/lwp9reader \
+ lotuswordpro/source/filter/lwpatomholder \
+ lotuswordpro/source/filter/lwpbackgroundoverride \
+ lotuswordpro/source/filter/lwpbackgroundstuff \
+ lotuswordpro/source/filter/lwpbasetype \
+ lotuswordpro/source/filter/lwpbookmarkmgr \
+ lotuswordpro/source/filter/lwpborderstuff \
+ lotuswordpro/source/filter/lwpbreaksoverride \
+ lotuswordpro/source/filter/lwpbulletstylemgr \
+ lotuswordpro/source/filter/lwpcelllayout \
+ lotuswordpro/source/filter/lwpchangemgr \
+ lotuswordpro/source/filter/lwpcharacterstyle \
+ lotuswordpro/source/filter/lwpcharborderoverride \
+ lotuswordpro/source/filter/lwpcharsetmgr \
+ lotuswordpro/source/filter/lwpcolor \
+ lotuswordpro/source/filter/lwpcontent \
+ lotuswordpro/source/filter/lwpdivinfo \
+ lotuswordpro/source/filter/lwpdivopts \
+ lotuswordpro/source/filter/lwpdlvlist \
+ lotuswordpro/source/filter/lwpdoc \
+ lotuswordpro/source/filter/lwpdocdata \
+ lotuswordpro/source/filter/lwpdrawobj \
+ lotuswordpro/source/filter/lwpdropcapmgr \
+ lotuswordpro/source/filter/lwpfilehdr \
+ lotuswordpro/source/filter/lwpfilter \
+ lotuswordpro/source/filter/lwpfnlayout \
+ lotuswordpro/source/filter/lwpfont \
+ lotuswordpro/source/filter/lwpfootnote \
+ lotuswordpro/source/filter/lwpfoundry \
+ lotuswordpro/source/filter/lwpframelayout \
+ lotuswordpro/source/filter/lwpfribbreaks \
+ lotuswordpro/source/filter/lwpfrib \
+ lotuswordpro/source/filter/lwpfribframe \
+ lotuswordpro/source/filter/lwpfribmark \
+ lotuswordpro/source/filter/lwpfribptr \
+ lotuswordpro/source/filter/lwpfribsection \
+ lotuswordpro/source/filter/lwpfribtable \
+ lotuswordpro/source/filter/lwpfribtext \
+ lotuswordpro/source/filter/lwpglobalmgr \
+ lotuswordpro/source/filter/lwpgrfobj \
+ lotuswordpro/source/filter/lwpholder \
+ lotuswordpro/source/filter/lwphyperlinkmgr \
+ lotuswordpro/source/filter/lwpidxmgr \
+ lotuswordpro/source/filter/lwplayout \
+ lotuswordpro/source/filter/lwplaypiece \
+ lotuswordpro/source/filter/lwplnopts \
+ lotuswordpro/source/filter/lwpmarker \
+ lotuswordpro/source/filter/lwpnotes \
+ lotuswordpro/source/filter/lwpnumberingoverride \
+ lotuswordpro/source/filter/lwpnumericfmt \
+ lotuswordpro/source/filter/lwpobj \
+ lotuswordpro/source/filter/lwpobjfactory \
+ lotuswordpro/source/filter/lwpobjhdr \
+ lotuswordpro/source/filter/lwpobjid \
+ lotuswordpro/source/filter/lwpobjstrm \
+ lotuswordpro/source/filter/lwpoleobject \
+ lotuswordpro/source/filter/lwpoverride \
+ lotuswordpro/source/filter/lwppagehint \
+ lotuswordpro/source/filter/lwppagelayout \
+ lotuswordpro/source/filter/lwppara1 \
+ lotuswordpro/source/filter/lwpparaborderoverride \
+ lotuswordpro/source/filter/lwppara \
+ lotuswordpro/source/filter/lwpparaproperty \
+ lotuswordpro/source/filter/lwpparastyle \
+ lotuswordpro/source/filter/lwpproplist \
+ lotuswordpro/source/filter/lwpprtinfo \
+ lotuswordpro/source/filter/lwprowlayout \
+ lotuswordpro/source/filter/lwpsdwfileloader \
+ lotuswordpro/source/filter/lwpsdwgrouploaderv0102 \
+ lotuswordpro/source/filter/lwpsdwrect \
+ lotuswordpro/source/filter/lwpsection \
+ lotuswordpro/source/filter/lwpsilverbullet \
+ lotuswordpro/source/filter/lwpsortopt \
+ lotuswordpro/source/filter/lwpstory \
+ lotuswordpro/source/filter/lwpsvstream \
+ lotuswordpro/source/filter/lwptable \
+ lotuswordpro/source/filter/lwptablelayout \
+ lotuswordpro/source/filter/lwptaboverride \
+ lotuswordpro/source/filter/lwptabrack \
+ lotuswordpro/source/filter/lwptblcell \
+ lotuswordpro/source/filter/lwptblformula \
+ lotuswordpro/source/filter/lwptoc \
+ lotuswordpro/source/filter/lwptools \
+ lotuswordpro/source/filter/lwpuidoc \
+ lotuswordpro/source/filter/lwpusrdicts \
+ lotuswordpro/source/filter/lwpverdocument \
+ lotuswordpro/source/filter/lwpvpointer \
+ lotuswordpro/source/filter/tocread \
+ lotuswordpro/source/filter/utbenvs \
+ lotuswordpro/source/filter/utlist \
+ lotuswordpro/source/filter/xfilter/xfbase64 \
+ lotuswordpro/source/filter/xfilter/xfbgimage \
+ lotuswordpro/source/filter/xfilter/xfborders \
+ lotuswordpro/source/filter/xfilter/xfcell \
+ lotuswordpro/source/filter/xfilter/xfcellstyle \
+ lotuswordpro/source/filter/xfilter/xfchange \
+ lotuswordpro/source/filter/xfilter/xfcolor \
+ lotuswordpro/source/filter/xfilter/xfcolstyle \
+ lotuswordpro/source/filter/xfilter/xfcolumns \
+ lotuswordpro/source/filter/xfilter/xfconfigmanager \
+ lotuswordpro/source/filter/xfilter/xfcontentcontainer \
+ lotuswordpro/source/filter/xfilter/xfcrossref \
+ lotuswordpro/source/filter/xfilter/xfdate \
+ lotuswordpro/source/filter/xfilter/xfdatestyle \
+ lotuswordpro/source/filter/xfilter/xfdocfield \
+ lotuswordpro/source/filter/xfilter/xfdrawareastyle \
+ lotuswordpro/source/filter/xfilter/xfdrawline \
+ lotuswordpro/source/filter/xfilter/xfdrawlinestyle \
+ lotuswordpro/source/filter/xfilter/xfdrawobj \
+ lotuswordpro/source/filter/xfilter/xfdrawpath \
+ lotuswordpro/source/filter/xfilter/xfdrawpolygon \
+ lotuswordpro/source/filter/xfilter/xfdrawpolyline \
+ lotuswordpro/source/filter/xfilter/xfdrawrect \
+ lotuswordpro/source/filter/xfilter/xfdrawstyle \
+ lotuswordpro/source/filter/xfilter/xfentry \
+ lotuswordpro/source/filter/xfilter/xffloatframe \
+ lotuswordpro/source/filter/xfilter/xffont \
+ lotuswordpro/source/filter/xfilter/xffontdecl \
+ lotuswordpro/source/filter/xfilter/xffontfactory \
+ lotuswordpro/source/filter/xfilter/xfframe \
+ lotuswordpro/source/filter/xfilter/xfframestyle \
+ lotuswordpro/source/filter/xfilter/xfglobal \
+ lotuswordpro/source/filter/xfilter/xfheaderstyle \
+ lotuswordpro/source/filter/xfilter/xfimage \
+ lotuswordpro/source/filter/xfilter/xfimagestyle \
+ lotuswordpro/source/filter/xfilter/xfindex \
+ lotuswordpro/source/filter/xfilter/xflist \
+ lotuswordpro/source/filter/xfilter/xfliststyle \
+ lotuswordpro/source/filter/xfilter/xfmargins \
+ lotuswordpro/source/filter/xfilter/xfmasterpage \
+ lotuswordpro/source/filter/xfilter/xfnumberstyle \
+ lotuswordpro/source/filter/xfilter/xfofficemeta \
+ lotuswordpro/source/filter/xfilter/xfpagemaster \
+ lotuswordpro/source/filter/xfilter/xfparagraph \
+ lotuswordpro/source/filter/xfilter/xfparastyle \
+ lotuswordpro/source/filter/xfilter/xfrow \
+ lotuswordpro/source/filter/xfilter/xfrowstyle \
+ lotuswordpro/source/filter/xfilter/xfsaxattrlist \
+ lotuswordpro/source/filter/xfilter/xfsaxstream \
+ lotuswordpro/source/filter/xfilter/xfsection \
+ lotuswordpro/source/filter/xfilter/xfsectionstyle \
+ lotuswordpro/source/filter/xfilter/xfshadow \
+ lotuswordpro/source/filter/xfilter/xfstylecont \
+ lotuswordpro/source/filter/xfilter/xfstyle \
+ lotuswordpro/source/filter/xfilter/xfstylemanager \
+ lotuswordpro/source/filter/xfilter/xftable \
+ lotuswordpro/source/filter/xfilter/xftablestyle \
+ lotuswordpro/source/filter/xfilter/xftabstyle \
+ lotuswordpro/source/filter/xfilter/xftextboxstyle \
+ lotuswordpro/source/filter/xfilter/xftextcontent \
+ lotuswordpro/source/filter/xfilter/xftextspan \
+ lotuswordpro/source/filter/xfilter/xftextstyle \
+ lotuswordpro/source/filter/xfilter/xftimestyle \
+ lotuswordpro/source/filter/xfilter/xfutil \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/lotuswordpro/Makefile b/lotuswordpro/Makefile
new file mode 100644
index 000000000..ccb1c85a0
--- /dev/null
+++ b/lotuswordpro/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/lotuswordpro/Module_lotuswordpro.mk b/lotuswordpro/Module_lotuswordpro.mk
new file mode 100644
index 000000000..d7be42321
--- /dev/null
+++ b/lotuswordpro/Module_lotuswordpro.mk
@@ -0,0 +1,25 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,lotuswordpro))
+
+ifeq ($(ENABLE_LWP),TRUE)
+
+$(eval $(call gb_Module_add_targets,lotuswordpro,\
+ Library_lwpft \
+))
+
+$(eval $(call gb_Module_add_check_targets,lotuswordpro,\
+ CppunitTest_lotuswordpro_test_lotuswordpro \
+ CppunitTest_lotuswordpro_import_test \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/lotuswordpro/README b/lotuswordpro/README
new file mode 100644
index 000000000..4ec710488
--- /dev/null
+++ b/lotuswordpro/README
@@ -0,0 +1 @@
+Filter for file format of Lotus Word Pro.
diff --git a/lotuswordpro/inc/localtime.hxx b/lotuswordpro/inc/localtime.hxx
new file mode 100644
index 000000000..1722b60d3
--- /dev/null
+++ b/lotuswordpro/inc/localtime.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LOCALTIME_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LOCALTIME_HXX
+
+struct LtTm
+{
+ long tm_sec; /* seconds after the minute - [0,59] */
+ long tm_min; /* minutes after the hour - [0,59] */
+ long tm_hour; /* hours since midnight - [0,23] */
+ long tm_mday; /* day of the month - [1,31] */
+ long tm_mon; /* months since January - [0,11] */
+ long tm_year; /* years since 1900 */
+ long tm_wday; /* days since Sunday - [0,6] */
+ long tm_yday; /* days since January 1 - [0,365] */
+ LtTm()
+ : tm_sec(0)
+ , tm_min(0)
+ , tm_hour(0)
+ , tm_mday(0)
+ , tm_mon(0)
+ , tm_year(0)
+ , tm_wday(0)
+ , tm_yday(0)
+ {
+ }
+};
+bool LtgGmTime(long rtime,LtTm& rtm);
+bool LtgLocalTime(long rtime,LtTm& rtm);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpatomholder.hxx b/lotuswordpro/inc/lwpatomholder.hxx
new file mode 100644
index 000000000..fc7084f27
--- /dev/null
+++ b/lotuswordpro/inc/lwpatomholder.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPATOMHOLDER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPATOMHOLDER_HXX
+
+#include <config_lgpl.h>
+#include "lwpdefs.hxx"
+#include "lwpobjstrm.hxx"
+/**
+ * @brief AtomHolder class of Word Pro to hold a string
+*/
+class LwpAtomHolder
+{
+public:
+ LwpAtomHolder();
+private:
+ sal_Int32 m_nAtom;
+ sal_Int32 m_nAssocAtom;
+ OUString m_String;
+ //OUString m_UniString; //no use temporarily
+public:
+ void Read(LwpObjectStream *pStrm);
+ void ReadPathAtom(LwpObjectStream *pStrm);
+ void Skip(LwpObjectStream *pStrm);
+ const OUString& str() const {return m_String;}
+ inline bool HasValue() const;
+};
+inline bool LwpAtomHolder::HasValue() const
+{
+ return (m_nAtom != BAD_ATOM);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpbasetype.hxx b/lotuswordpro/inc/lwpbasetype.hxx
new file mode 100644
index 000000000..20b4c625c
--- /dev/null
+++ b/lotuswordpro/inc/lwpbasetype.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * basic classes for Word Pro filter,
+ * PanoseNumber, Point
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPBASETYPE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPBASETYPE_HXX
+
+#include "lwpobjstrm.hxx"
+#include <config_lgpl.h>
+
+/**
+ * @brief used for lwpfont for font description
+*/
+class LwpPanoseNumber
+{
+public:
+ LwpPanoseNumber()
+ : m_nFamilyType(0)
+ , m_nSerifStyle(0)
+ , m_nWeight(0)
+ , m_nProportion(0)
+ , m_nContrast(0)
+ , m_nStrokeVariation(0)
+ , m_nArmStyle(0)
+ , m_nLetterform(0)
+ , m_nMidline(0)
+ , m_nXHeight(0)
+ {
+ }
+public:
+ void Read(LwpObjectStream *pStrm);
+private:
+ sal_uInt8 m_nFamilyType;
+ sal_uInt8 m_nSerifStyle;
+ sal_uInt8 m_nWeight;
+ sal_uInt8 m_nProportion;
+ sal_uInt8 m_nContrast;
+ sal_uInt8 m_nStrokeVariation;
+ sal_uInt8 m_nArmStyle;
+ sal_uInt8 m_nLetterform;
+ sal_uInt8 m_nMidline;
+ sal_uInt8 m_nXHeight;
+};
+/**
+ * @brief point class
+*/
+class LwpPoint final
+{
+public:
+ LwpPoint();
+ void Read(LwpObjectStream *pStrm);
+ void Reset();
+ sal_Int32 GetX() const {return m_nX;}
+ sal_Int32 GetY() const {return m_nY;}
+ inline void SetX(sal_Int32 nX);
+ inline void SetY(sal_Int32 nY);
+private:
+ sal_Int32 m_nX;
+ sal_Int32 m_nY;
+};
+
+void LwpPoint::SetX(sal_Int32 nX){m_nX = nX;}
+void LwpPoint::SetY(sal_Int32 nY){m_nY = nY;}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpbookmarkmgr.hxx b/lotuswordpro/inc/lwpbookmarkmgr.hxx
new file mode 100644
index 000000000..3cc02b121
--- /dev/null
+++ b/lotuswordpro/inc/lwpbookmarkmgr.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPBOOKMARKMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPBOOKMARKMGR_HXX
+
+#include <config_lgpl.h>
+
+#include <map>
+
+#include <rtl/ref.hxx>
+
+#include "xfilter/xfbookmark.hxx"
+
+class LwpBookmarkMgr
+{
+public:
+ void AddXFBookmarkEnd(const OUString& sName, XFBookmarkEnd* pMark);
+ void AddXFBookmarkStart(const OUString& sName, XFBookmarkStart* pMark);
+ bool FindBookmark(const OUString& sName);
+ ~LwpBookmarkMgr();
+ LwpBookmarkMgr();
+
+private:
+ std::map<OUString, rtl::Reference<XFBookmarkStart>> m_MapStart;
+ std::map<OUString, rtl::Reference<XFBookmarkEnd>> m_MapEnd;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpchangemgr.hxx b/lotuswordpro/inc/lwpchangemgr.hxx
new file mode 100644
index 000000000..b436024e8
--- /dev/null
+++ b/lotuswordpro/inc/lwpchangemgr.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPCHANGEMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPCHANGEMGR_HXX
+
+#include <map>
+#include <vector>
+#include <config_lgpl.h>
+#include "lwpfrib.hxx"
+#include "xfilter/xfchange.hxx"
+#include "xfilter/xfcontentcontainer.hxx"
+
+class LwpChangeMgr
+{
+public:
+ void AddChangeFrib(LwpFrib* pFrib);
+ OUString GetChangeID(LwpFrib* pFrib);
+ void ConvertAllChange(IXFStream* pStream);
+ void SetHeadFootFribMap(bool bFlag);
+ void SetHeadFootChange(XFContentContainer* pCont);
+ ~LwpChangeMgr();
+ LwpChangeMgr();
+
+private:
+ std::map<LwpFrib*, OUString>* m_pFribMap;
+ std::map<LwpFrib*, OUString> m_DocFribMap;
+ std::map<LwpFrib*, OUString> m_HeadFootFribMap;
+ std::vector<rtl::Reference<XFChangeRegion>> m_ChangeList;
+ sal_uInt32 m_nCounter;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpcolor.hxx b/lotuswordpro/inc/lwpcolor.hxx
new file mode 100644
index 000000000..b555302bd
--- /dev/null
+++ b/lotuswordpro/inc/lwpcolor.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPCOLOR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPCOLOR_HXX
+
+#include "lwpobjstrm.hxx"
+#include <config_lgpl.h>
+/**
+ * @brief lwpcolor class
+ * (red, green, blue, extra)
+*/
+class LwpColor
+{
+public:
+ LwpColor():m_nRed(0), m_nGreen(0), m_nBlue(0), m_nExtra(0){}
+public:
+ void Read(LwpObjectStream *pStrm);
+ sal_uInt16 GetRed() const;
+ sal_uInt16 GetGreen() const;
+ sal_uInt16 GetBlue() const;
+ bool IsValidColor() const;
+ sal_uInt32 To24Color();
+ bool IsTransparent() const;
+private:
+ sal_uInt16 m_nRed; // When extra is AGLRGB_INDEX, m_nRed holds the
+ sal_uInt16 m_nGreen; // hi 16 bits and m_nGreen holds the lo 16 bits of
+ sal_uInt16 m_nBlue; // the 32-bit LUT index.
+ sal_uInt16 m_nExtra;
+ enum ColorOverride {
+ AGLRGB_RGB = 0,
+ AGLRGB_BLACK = 1,
+ AGLRGB_WHITE = 2,
+ AGLRGB_GRAY = 3,
+ AGLRGB_LTGRAY = 4,
+ AGLRGB_DKGRAY = 5,
+ AGLRGB_RED = 6,
+ AGLRGB_GREEN = 7,
+ AGLRGB_BLUE = 8,
+ AGLRGB_INDEX = 98,
+ AGLRGB_INVALID = 99,
+ AGLRGB_TRANSPARENT = 100
+ };
+};
+inline sal_uInt16 LwpColor::GetRed() const
+{
+ return m_nRed;
+}
+inline sal_uInt16 LwpColor::GetGreen() const
+{
+ return m_nGreen;
+}
+inline sal_uInt16 LwpColor::GetBlue() const
+{
+ return m_nBlue;
+}
+inline bool LwpColor::IsValidColor() const
+{
+ return ((m_nExtra!=AGLRGB_INVALID) && (m_nExtra!=AGLRGB_TRANSPARENT));
+}
+inline bool LwpColor::IsTransparent() const
+{
+ return (m_nExtra==AGLRGB_TRANSPARENT);
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpdefs.hxx b/lotuswordpro/inc/lwpdefs.hxx
new file mode 100644
index 000000000..2cf89eaa6
--- /dev/null
+++ b/lotuswordpro/inc/lwpdefs.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * definitions for all object types VO_TYPE
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPDEFS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPDEFS_HXX
+
+#define BAD_OFFSET 0xFFFFFFFFUL
+#define BAD_ATOM (sal_Int32(-1)) // Invalid Atom ID
+
+//Please remove the item from the commented defines after you add the tag to the following enum.
+enum VO_TYPE
+{
+ VO_PARA = 0,
+ VO_DOCUMENT = 5,
+ VO_STORY = 13,
+ VO_VERQTR = 40,
+ VO_HEADCONTENT = 47,
+ VO_HEADLAYOUT = 142,
+ VO_PAGELAYOUT = 143,
+ VO_DOCSOCK = 155,
+ VO_DIVISIONINFO = 7,
+ VO_HEADHOLDER = 90,
+ VO_DIVOPTS = 176,
+ VO_DOCDATA = 137,
+ VO_HEADERLAYOUT = 139,
+ VO_FOOTERLAYOUT = 140,
+ VO_FRAMELAYOUT = 141,
+ VO_TOCSUPERTABLELAYOUT = 149,
+ VO_TOCLEVELDATA = 171,
+ VO_LAYOUTGEOMETRY = 185,
+ VO_LAYOUTSCALE = 186,
+ VO_LAYOUTMARGINS = 187,
+ VO_LAYOUTCOLUMNS = 188,
+ VO_LAYOUTBORDERSTUFF = 189,
+ VO_LAYOUTGUTTERSTUFF = 190,
+ VO_LAYOUTBACKGROUNDSTUFF = 191,
+ VO_LAYOUTJOINSTUFF = 192,
+ VO_LAYOUTSHADOW = 193,
+ VO_LAYOUTNUMERICS = 194,
+ VO_LAYOUTRELATIVITY = 195,
+ VO_LAYOUTEXTERNALBORDERSTUFF = 219,
+ VO_GRAPHIC = 41,
+ VO_VERGTR = 205,
+
+ VO_PARASTYLE = 23,
+ VO_CHARACTERSTYLE = 106,
+ VO_SILVERBULLET = 127,
+ VO_ALIGNMENTPIECE = 196,
+ VO_INDENTPIECE = 197,
+ VO_SPACINGPIECE = 199,
+ VO_CHARBORDERPIECE = 202,
+ VO_AMIKAKEPIECE = 203,
+
+ VO_TABRACK = 38,
+ VO_PARABORDERPIECE = 198,
+ VO_BREAKSPIECE = 200,
+ VO_NUMBERINGPIECE = 201,
+ VO_TABPIECE = 204,
+ VO_PARABACKGROUNDPIECE = 218,
+
+ VO_SECTION = 136,
+ VO_INDEXSECTION = 48,
+ VO_HEADTAILHOLDER = 169,
+ VO_PAGEHINT = 10,
+ VO_OBJECTHOLDER = 98,
+ VO_POBJECTHOLDER = 133,
+ // added for OLE
+ VO_OLEOBJECT = 54,
+
+ // added for table
+ VO_TABLE = 17,
+ VO_CELLLAYOUT = 18,
+ VO_SUPERTABLELAYOUT = 109,
+ VO_TABLELAYOUT = 31,
+ VO_SUPERTABLE = 115,
+ VO_ROWLAYOUT = 32,
+ VO_ROWLIST = 76,
+ VO_CELLLIST = 74,
+ VO_NUMERICVALUE = 123,
+ VO_FORMULAINFO = 82,
+ VO_COLUMNLAYOUT = 35,
+ VO_TABLERANGE = 66,
+ VO_CELLRANGE = 67,
+ VO_FOLDER = 75,
+ VO_DEPENDENT = 77,
+ VO_CONNECTEDCELLLAYOUT = 28,
+ VO_HIDDENCELLLAYOUT = 29,
+ VO_TABLEHEADINGLAYOUT = 117,
+ VO_ROWHEADINGLAYOUT = 118,
+ VO_TABLEHEADING = 209,
+ VO_TABLEHINT = 19,
+
+ VO_DROPCAPLAYOUT = 217,
+ VO_CHBLKMARKER = 94,
+ VO_PROPLIST = 165,
+ VO_BOOKMARK = 64,
+ VO_FIELDMARKER = 87,
+
+ //for footnote
+ VO_FOOTNOTE = 53,
+ VO_FOOTNOTEOPTS = 177,
+ VO_FOOTNOTELAYOUT = 65,
+ VO_FNROWLAYOUT = 59,
+ VO_FNCELLLAYOUT = 61,
+ VO_ENDNOTELAYOUT = 138,
+ VO_ENSUPERTABLELAYOUT = 113,
+ VO_FNSUPERTABLELAYOUT = 111,
+ VO_FOOTNOTETABLE = 58,
+ VO_CONTONLAYOUT = 145,
+ VO_CONTFROMLAYOUT = 146,
+
+ //for frame group
+ VO_GROUPLAYOUT = 108,
+ VO_GROUPFRAME = 173,
+
+ //For index manager
+ VO_ROOTLEAFOBJINDEX = 0xFFFB, // Root Index with no kids
+ VO_ROOTOBJINDEX = 0xFFFC, // Root Index with kids
+
+ //Add new type of index
+ VO_OBJINDEX = 0xFFFD, // Obj Index with kids
+
+ VO_LEAFOBJINDEX = 0xFFFE , // Leaf Index
+
+ VO_LISTLIST = 100,
+
+ //For comment notes
+ VO_NOTELAYOUT = 159,
+ VO_NOTEHEADERLAYOUT = 178,
+ VO_NOTETEXTLAYOUT = 166,
+ VO_VPLAYOUT = 132,
+
+ // for parallel column
+ VO_SUPERPARALLELCOLUMNLAYOUT = 174,
+ VO_PCOLLAYOUT = 206,
+ VO_PCOLBLOCK = 207,
+ VO_PARALLELCOLUMNS = 163,
+
+ //for ruby mark
+ VO_RUBYMARKER = 179,
+ VO_RUBYLAYOUT = 180,
+
+ VO_GLOSSARY = 157,
+ VO_SUPERGLOSSARYLAYOUT = 175,
+ //for default tab distance
+ VO_VERDOCUMENT = 161,
+
+ //The last one
+ VO_INVALID = -1
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpdocdata.hxx b/lotuswordpro/inc/lwpdocdata.hxx
new file mode 100644
index 000000000..b04c00bb1
--- /dev/null
+++ b/lotuswordpro/inc/lwpdocdata.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPDOCDATA_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPDOCDATA_HXX
+#include <config_lgpl.h>
+#include "lwpobj.hxx"
+#include "lwpatomholder.hxx"
+#include "localtime.hxx"
+#include "lwpcolor.hxx"
+
+struct LwpDocOptions
+{
+ sal_uInt16 nOptionFlag;
+ LwpAtomHolder encrypt1password;
+ LwpAtomHolder encrypt2password;
+ LwpAtomHolder characterSet;
+ LwpAtomHolder grammerSet;
+ sal_uInt16 nMarginMarks;
+ sal_uInt16 nMarginMarksLocation;
+ sal_uInt16 nMarginMarksChar;
+};
+struct LwpDocInfo
+{
+ LwpAtomHolder description;
+ LwpAtomHolder keywords;
+ LwpAtomHolder createdBy;
+ sal_Int32 nCreationTime;
+ sal_Int32 nLastRevisionTime;
+ sal_Int32 nTotalEditTime;
+ LwpObjectID cpVerDocInfo;
+ sal_uInt16 nNumEditedBy;
+ //skip editor list
+};
+struct LwpDocControl
+{
+ LwpAtomHolder cGreeting;
+ sal_uInt16 nFlags;
+ sal_uInt16 nDocControlProtection;
+ sal_uInt16 nLen1;
+ //skip doc control password string
+ sal_uInt16 nFileProtection;
+ sal_uInt16 nLen2;
+ //skip file password string
+ sal_uInt16 nAutoVersioning;
+ LwpAtomHolder cDocControlOnlyEditor;
+ sal_uInt16 nEditorVerification;
+};
+struct LwpFontDescriptionOverrideBase
+{
+ sal_uInt8 cOverrideBits;
+ sal_uInt8 cApplyBits;
+ sal_Int32 cPointSize;
+ sal_uInt8 cOverstrike;
+ sal_uInt16 cTightness;
+ //lcolor cColor;
+ //lcolor cBackgroundColor;
+ LwpColor cColor;
+ LwpColor cBackgroundColor;
+};
+struct LwpFontAttributeOverride
+{
+ sal_uInt16 cAttrBits;
+ sal_uInt16 cAttrOverrideBits;
+ sal_uInt16 cAttrApplyBits;
+ sal_uInt8 cAttrOverrideBits2;
+ sal_uInt8 cAttrApplyBits2;
+ sal_uInt8 cCase;
+ sal_uInt8 cUnder;
+};
+struct LwpFontDescriptionOverride
+{
+ LwpFontAttributeOverride cFontAttributeOverride;
+ LwpFontDescriptionOverrideBase cFontDescriptionOverrideBase;
+ LwpAtomHolder cFaceName;
+ LwpAtomHolder cAltFaceName;
+};
+struct LwpOverrideOg
+{
+ sal_uInt16 cValues;
+ sal_uInt16 cOverride;
+ sal_uInt16 cApply;
+};
+struct LwpTextAttributeOverrideOg
+{
+ LwpOverrideOg cOverride;
+ sal_uInt16 cHideLevels;
+ sal_Int32 cBaselineOffset;
+};
+struct LwpEditorAttr
+{
+ LwpAtomHolder cName;
+ LwpAtomHolder cInitials;
+ LwpColor cHiLiteColor;
+ sal_uInt16 nID;
+ LwpFontDescriptionOverride cInsFontOver;
+ LwpFontDescriptionOverride cDelFontOver;
+ sal_uInt16 nAbilities;
+ sal_uInt16 nLocks;
+ sal_uInt16 nSuggestions;
+ LwpTextAttributeOverrideOg cDelTextAttr;
+};
+class LwpDocData : public LwpObject
+{
+public:
+ LwpDocData(LwpObjectHeader const& objHdr, LwpSvStream* pStrm);
+
+private:
+ virtual ~LwpDocData() override;
+
+ LwpDocOptions m_DocOptions;
+ LwpDocInfo m_DocInfo;
+ LwpDocControl m_DocControl;
+
+private:
+ LtTm m_nCreationTime;
+ LtTm m_nLastRevisionTime;
+ LtTm m_nTotalEditTime;
+
+private:
+ static OUString DateTimeToOUString(LtTm const& dt);
+ static OUString TimeToOUString(LtTm const& dt);
+
+public:
+ void Read() override;
+ void Parse(IXFStream* pOutputStream) override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpdropcapmgr.hxx b/lotuswordpro/inc/lwpdropcapmgr.hxx
new file mode 100644
index 000000000..6ad122e69
--- /dev/null
+++ b/lotuswordpro/inc/lwpdropcapmgr.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPDROPCAPMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPDROPCAPMGR_HXX
+
+#include "xfilter/xfparagraph.hxx"
+
+class LwpDropcapMgr
+{
+public:
+ LwpDropcapMgr();
+ ~LwpDropcapMgr();
+ void SetXFPara(XFParagraph* pXFPara);
+ XFParagraph* GetXFPara() { return m_pXFPara; }
+
+private:
+ XFParagraph* m_pXFPara;
+};
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpfilehdr.hxx b/lotuswordpro/inc/lwpfilehdr.hxx
new file mode 100644
index 000000000..2bb49127a
--- /dev/null
+++ b/lotuswordpro/inc/lwpfilehdr.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPFILEHDR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPFILEHDR_HXX
+
+#include "lwpobjid.hxx"
+/**
+ * @brief LWP7 object
+*/
+class LwpFileHeader
+{
+public:
+ LwpFileHeader();
+private: //data member
+ sal_uInt16 m_nAppRevision;
+ sal_uInt16 m_nAppReleaseNo;
+ sal_uInt16 m_nRequiredAppRevision;
+ sal_uInt16 m_nRequiredFileRevision;
+ LwpObjectID m_cDocumentID;
+ sal_uInt32 m_nRootIndexOffset;
+public:
+ static sal_uInt16 m_nFileRevision;
+ void Read(LwpSvStream *pStrm);
+ sal_uInt32 GetRootIndexOffset() const;
+ LwpObjectID& GetDocID();
+};
+inline sal_uInt32 LwpFileHeader::GetRootIndexOffset() const
+{
+ return m_nRootIndexOffset;
+}
+inline LwpObjectID& LwpFileHeader::GetDocID()
+{
+ return m_cDocumentID;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpfont.hxx b/lotuswordpro/inc/lwpfont.hxx
new file mode 100644
index 000000000..301c65e9e
--- /dev/null
+++ b/lotuswordpro/inc/lwpfont.hxx
@@ -0,0 +1,289 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Font manager related classes header file
+ * LwpFontTableEntry, LwpFontTable, LwpFontNameEntry,
+ * LwpFontAttrEntry, LwpFontNameManager,LwpFontAttrManager,
+ * LwpFontManager
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPFONT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPFONT_HXX
+
+#include <config_lgpl.h>
+#include <rtl/ref.hxx>
+#include "lwpobjstrm.hxx"
+#include "lwpatomholder.hxx"
+#include "lwpcolor.hxx"
+#include "xfilter/xffont.hxx"
+#include <memory>
+
+class LwpFontTableEntry
+{
+public:
+ LwpFontTableEntry(){}
+public:
+ void Read(LwpObjectStream *pStrm);
+ OUString const & GetFaceName() const;
+private:
+ LwpAtomHolder m_WindowsFaceName; //font face name under windows
+ LwpAtomHolder m_FaceName; //font face name
+ void RegisterFontDecl();
+ //Not useful now, so skip
+ //LwpPanoseNumber m_PanoseNumber;
+};
+
+class LwpFontTable
+{
+public:
+ LwpFontTable();
+ ~LwpFontTable();
+public:
+ void Read(LwpObjectStream *pStrm);
+ OUString GetFaceName(sal_uInt16 index); //index: start from 1
+// void RegisterFontDecls();
+private:
+ sal_uInt16 m_nCount;
+ std::unique_ptr<LwpFontTableEntry[]> m_pFontEntries;
+};
+
+class LwpFontNameEntry
+{
+public:
+ LwpFontNameEntry()
+ : m_nOverrideBits(0)
+ , m_nApplyBits(0)
+ , m_nPointSize(0)
+ , m_nOverstrike(0)
+ , m_nTightness(0)
+ , m_nFaceName(0)
+ , m_nAltFaceName(0)
+ {}
+public:
+ void Read(LwpObjectStream *pStrm);
+ sal_uInt16 GetFaceID() const {return m_nFaceName;}
+ sal_uInt16 GetAltFaceID() const {return m_nAltFaceName;}
+ void Override(rtl::Reference<XFFont> const & pFont);
+ inline bool IsFaceNameOverridden() const;
+ inline bool IsAltFaceNameOverridden() const;
+private:
+ //Data of CFontDescriptionOverrideBase
+ sal_uInt8 m_nOverrideBits;
+ sal_uInt8 m_nApplyBits;
+ sal_uInt32 m_nPointSize;
+ sal_uInt16 m_nOverstrike;
+ sal_uInt16 m_nTightness;
+ LwpColor m_Color;
+ LwpColor m_BackColor;
+ //Data of LwpFontNameEntry
+ sal_uInt16 m_nFaceName; //CFontTableID
+ sal_uInt16 m_nAltFaceName; //CFontTableID
+ enum
+ {
+ POINTSIZE = 0x01,
+ COLOR = 0x02,
+ OVERSTRIKE = 0x04,
+ TIGHTNESS = 0x08,
+ FACENAME = 0x10,
+ BKCOLOR = 0x20,
+ ALTFACENAME = 0x40,
+ ALL_BITS = (POINTSIZE | COLOR | OVERSTRIKE
+ | ALTFACENAME
+ | TIGHTNESS | FACENAME | BKCOLOR)
+ };
+
+ inline bool IsPointSizeOverridden() const;
+ inline bool IsColorOverridden() const;
+ inline bool IsBackgroundColorOverridden() const;
+//TODO
+// inline sal_Bool IsTightnessOverridden();
+// inline sal_Bool IsAnythingOverridden();
+};
+
+class LwpFontNameManager
+{
+public:
+ LwpFontNameManager();
+ ~LwpFontNameManager();
+ OUString GetNameByIndex(sal_uInt16 index);
+private:
+ sal_uInt16 m_nCount;
+ std::unique_ptr<LwpFontNameEntry[]> m_pFontNames;
+ LwpFontTable m_FontTbl;
+
+public:
+ void Read(LwpObjectStream *pStrm);
+ void Override(sal_uInt16 index, rtl::Reference<XFFont> const & pFont);
+};
+
+class LwpFontAttrEntry
+{
+public:
+ LwpFontAttrEntry()
+ : m_nAttrBits(0)
+ , m_nAttrOverrideBits(0)
+ , m_nAttrApplyBits(0)
+ , m_nAttrOverrideBits2(0)
+ , m_nAttrApplyBits2(0)
+ , m_nCase(0)
+ , m_nUnder(0)
+ {}
+public:
+ void Read(LwpObjectStream *pStrm);
+ void Override(rtl::Reference<XFFont> const & pFont);
+private:
+ sal_uInt16 m_nAttrBits;
+ sal_uInt16 m_nAttrOverrideBits;
+ sal_uInt16 m_nAttrApplyBits;
+ sal_uInt8 m_nAttrOverrideBits2;
+ sal_uInt8 m_nAttrApplyBits2;
+ sal_uInt8 m_nCase;
+ sal_uInt8 m_nUnder;
+ enum
+ {
+ BOLD = 0x0001,
+ ITALIC = 0x0002,
+ STRIKETHRU = 0x0004,
+
+ SUPERSCRIPT = 0x0100,
+ SUBSCRIPT = 0x0200,
+
+ SMALLCAPS = 0x0400,
+
+ ALL_ATTRS = BOLD | ITALIC | STRIKETHRU
+ | SUPERSCRIPT | SUBSCRIPT
+ | SMALLCAPS,
+
+ CASE_DONTCARE = 0,
+ CASE_NORMAL = 1,
+ CASE_UPPER = 2,
+ CASE_LOWER = 3,
+ CASE_INITCAPS = 4,
+ CASE_STYLE = 7,
+
+ UNDER_DONTCARE = 0,
+ UNDER_OFF = 1,
+ UNDER_SINGLE = 2,
+ UNDER_DOUBLE = 3,
+ UNDER_WORD_SINGLE = 4,
+ UNDER_WORD_DOUBLE = 5,
+ UNDER_STYLE = 7,
+
+ CASE = 0x01,
+ UNDER = 0x02,
+ ALL_ATTRS2 = CASE | UNDER
+ };
+ bool Is(sal_uInt16 Attr);
+ bool IsBoldOverridden() const;
+ bool IsItalicOverridden() const;
+ bool IsStrikeThruOverridden() const;
+ bool IsSmallCapsOverridden() const;
+ bool IsSuperOverridden() const;
+ bool IsSubOverridden() const;
+ bool IsUnderlineOverridden() const;
+ bool IsCaseOverridden() const;
+
+};
+
+class LwpFontAttrManager
+{
+public:
+ LwpFontAttrManager()
+ : m_nCount(0)
+ {}
+ ~LwpFontAttrManager();
+public:
+ void Read(LwpObjectStream *pStrm);
+ void Override(sal_uInt16 index, rtl::Reference<XFFont> const & pFont);
+private:
+ sal_uInt16 m_nCount;
+ std::unique_ptr<LwpFontAttrEntry[]> m_pFontAttrs;
+};
+
+class LwpFontManager
+{
+public:
+ LwpFontManager(){}
+private:
+ LwpFontNameManager m_FNMgr;
+ LwpFontAttrManager m_AttrMgr;
+
+public:
+ void Read(LwpObjectStream *pStrm);
+ rtl::Reference<XFFont> CreateOverrideFont(sal_uInt32 fontID, sal_uInt32 overID);
+ rtl::Reference<XFFont> CreateFont(sal_uInt32 fontID);
+ OUString GetNameByID(sal_uInt32 fontID);
+
+private:
+ void Override(sal_uInt32 fontID, rtl::Reference<XFFont> const & pFont);
+ static inline sal_uInt16 GetFontNameIndex(sal_uInt32 fontID);
+ static inline sal_uInt16 GetFontAttrIndex(sal_uInt32 fontID);
+};
+
+sal_uInt16 LwpFontManager::GetFontNameIndex(sal_uInt32 fontID)
+{
+ return static_cast<sal_uInt16>((fontID>>16)&0xFFFF);
+}
+
+sal_uInt16 LwpFontManager::GetFontAttrIndex(sal_uInt32 fontID)
+{
+ return static_cast<sal_uInt16>(fontID);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpfoundry.hxx b/lotuswordpro/inc/lwpfoundry.hxx
new file mode 100644
index 000000000..36919dd9d
--- /dev/null
+++ b/lotuswordpro/inc/lwpfoundry.hxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPFOUNDRY_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPFOUNDRY_HXX
+
+#include <config_lgpl.h>
+#include "lwpobjid.hxx"
+#include "lwpobjstrm.hxx"
+#include "lwpfont.hxx"
+#include "lwpdropcapmgr.hxx"
+#include "xfilter/ixfstyle.hxx"
+#include <unordered_map>
+
+class LwpDocument;
+class LwpBookMark;
+
+#include <memory>
+
+class LwpVersionManager
+{
+public:
+ LwpVersionManager() = delete;
+ static void Read(LwpObjectStream *pStrm);
+ static void Skip(LwpObjectStream *pStrm);
+};
+
+class LwpObjectManager
+{
+public:
+ LwpObjectManager(){}
+private:
+ LwpObjectID m_Division;
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+
+class LwpNumberManager
+{
+public:
+ LwpNumberManager(){}
+private:
+ LwpObjectID m_TableRange;
+public:
+ void Read(LwpObjectStream *pStrm);
+ const LwpObjectID& GetTableRangeID() const { return m_TableRange;}
+};
+
+class LwpBulletManager
+{
+public:
+ LwpBulletManager(){}
+private:
+ LwpObjectID m_Head;
+public:
+ void Read(LwpObjectStream *pStrm);
+ LwpObjectID& GetHeadID() { return m_Head;}
+};
+
+class LwpContent;
+class LwpContentManager
+{
+public:
+ LwpContentManager(){}
+private:
+ LwpObjectID m_ContentList;
+ LwpObjectID m_EnumHead;
+ LwpObjectID m_EnumTail;
+ LwpObjectID m_OleObjCount;
+
+ LwpObjectID m_GrapHead;
+ LwpObjectID m_GrapTail;
+ LwpObjectID m_OleHead;
+ LwpObjectID m_OleTail;
+public:
+ LwpObjectID& GetContentList() { return m_ContentList; }
+ LwpObjectID& GetGraphicListHead() { return m_GrapHead; }
+ LwpContent* EnumContents(LwpContent* pContent);
+
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+
+class LwpPieceManager
+{
+public:
+ LwpPieceManager(){}
+private:
+ LwpObjectID m_GeometryPieceList;
+ LwpObjectID m_ScalePieceList;
+ LwpObjectID m_MarginsPieceList;
+ LwpObjectID m_ColumnsPieceList;
+ LwpObjectID m_BorderStuffPieceList;
+ LwpObjectID m_GutterStuffPieceList;
+ LwpObjectID m_BackgroundStuffPieceList;
+ LwpObjectID m_JoinStuffPieceList;
+ LwpObjectID m_ShadowPieceList;
+ LwpObjectID m_NumericsPieceList;
+ LwpObjectID m_RelativityPieceList;
+ LwpObjectID m_AlignmentPieceList;
+ LwpObjectID m_IndentPieceList;
+ LwpObjectID m_ParaBorderPieceList;
+ LwpObjectID m_SpacingPieceList;
+ LwpObjectID m_BreaksPieceList;
+ LwpObjectID m_NumberingPieceList;
+ LwpObjectID m_TabPieceList;
+ LwpObjectID m_CharacterBorderPieceList;
+ LwpObjectID m_AmikakePieceList;
+
+ LwpObjectID m_ParaBackgroundPieceList;
+ LwpObjectID m_ExternalBorderStuffPieceList;
+ LwpObjectID m_ExternalJoinStuffPieceList;
+
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+
+class LwpOrderedObject;
+class LwpListList;
+class LwpOrderedObjectManager final
+{
+public:
+ LwpOrderedObjectManager(){}
+ void Read(LwpObjectStream *pStrm);
+ LwpOrderedObject* Enumerate(LwpOrderedObject* pLast);
+private:
+ LwpListList* GetNextActiveListList(LwpListList* pLast);
+
+ LwpObjectID m_Head;
+};
+
+class LwpStyleManager;
+class LwpSection;
+class LwpBulletStyleMgr;
+class LwpFoundry
+{
+public:
+ LwpFoundry( LwpObjectStream *pStrm, LwpDocument* pDoc );
+ ~LwpFoundry();
+ void Read(LwpObjectStream *pStrm);
+ void RegisterAllLayouts();
+private:
+ LwpDocument* m_pDoc;
+ bool m_bRegisteredAll;
+private: //file members
+ LwpObjectManager m_ObjMgr;
+ LwpObjectID m_MarkerHead;
+ LwpObjectID m_FootnoteMgr;
+ LwpNumberManager m_NumMgr;
+ LwpBulletManager m_BulMgr;
+ LwpOrderedObjectManager m_SectionList;
+
+ LwpObjectID m_Layout; //The head layout
+ LwpObjectID m_TextStyle;
+ LwpObjectID m_DefaultTextStyle;
+ LwpObjectID m_DefaultClickStyle;
+ LwpObjectID m_PageStyle;
+ LwpObjectID m_FrameStyle;
+ LwpObjectID m_TableStyle;
+ LwpObjectID m_CellStyle;
+ LwpObjectID m_DftFrameStyle;
+ LwpObjectID m_DftPageStyle;
+ LwpObjectID m_DftTableStyle;
+ LwpObjectID m_DftCellStyle;
+ LwpObjectID m_DftColumnStyle;
+ LwpObjectID m_DftLeftColumnStyle;
+ LwpObjectID m_DftRighColumnStyle;
+
+ LwpObjectID m_BookMarkHead;
+ LwpObjectID m_DdeLinkHead;
+ LwpObjectID m_DirtBagHead;
+ LwpObjectID m_NamedOutlineSeqHead;
+ LwpObjectID m_EnumLayoutHead;
+ LwpObjectID m_EnumLayoutTail;
+
+ LwpObjectID m_NamedObjects;
+ sal_uInt32 m_nLastClickHere;
+
+ LwpObjectID m_SmartTextMgr;
+
+ LwpContentManager m_ContentMgr;
+ LwpFontManager m_FontMgr;
+ std::unique_ptr<LwpPieceManager> m_xPieceMgr;
+
+ LwpObjectID m_DftDropCapStyle;
+ LwpObjectID m_DftHeaderStyle;
+
+ LwpObjectID m_DftFooterStyle;
+private:
+ void ReadStyles(LwpObjectStream *pStrm);
+public:
+ LwpContentManager& GetContentManager() { return m_ContentMgr; }
+ LwpObjectID& GetGraphicListHead() { return m_ContentMgr.GetGraphicListHead(); }
+ LwpFontManager& GetFontManger() { return m_FontMgr;}
+ LwpObjectID& GetTextStyleHead() { return m_TextStyle;}
+ LwpObjectID& GetLayout() {return m_Layout;}
+ LwpObjectID& GetBulletManagerID() { return m_BulMgr.GetHeadID();}
+ LwpDocument* GetDocument(){ return m_pDoc;}
+ LwpNumberManager& GetNumberManager() { return m_NumMgr;}
+ LwpObjectID * GetDefaultTextStyle() ;
+private:
+ std::unique_ptr<LwpStyleManager> m_xStyleMgr;
+ std::unique_ptr<LwpDropcapMgr> m_xDropcapMgr;
+ std::unique_ptr<LwpBulletStyleMgr> m_xBulletStyleMgr;
+public:
+ LwpStyleManager* GetStyleManager() { return m_xStyleMgr.get(); }
+ LwpBookMark* GetBookMark(LwpObjectID objMarker);
+ LwpDropcapMgr* GetDropcapMgr() { return m_xDropcapMgr.get(); }
+ LwpContent* EnumContents(LwpContent* pContent);
+ LwpSection* EnumSections(LwpSection* pSection);
+ LwpBulletStyleMgr* GetBulletStyleMgr() { return m_xBulletStyleMgr.get(); }
+
+ LwpObjectID* FindParaStyleByName(const OUString& name);
+ OUString FindActuralStyleName(const OUString& name);
+};
+
+class LwpStyleManager
+{
+public:
+ LwpStyleManager();
+ ~LwpStyleManager();
+private:
+ LwpFoundry* m_pFoundry;
+ struct hashFunc
+ {
+ size_t operator()( const LwpObjectID& rName ) const
+ {
+ return rName.HashCode();
+ }
+ };
+ struct eqFunc
+ {
+ bool operator()( const LwpObjectID& rKey1, const LwpObjectID& rKey2 ) const
+ {
+ return(rKey1==rKey2);
+ }
+ };
+
+ typedef std::unordered_map<LwpObjectID, IXFStyle*, hashFunc, eqFunc> LwpStyleMap;
+ LwpStyleMap m_StyleList;
+public:
+ void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;}
+ void AddStyle(LwpObjectID styleObjID, std::unique_ptr<IXFStyle> pStyle);
+ IXFStyle* GetStyle(const LwpObjectID &styleObjID);
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpfrib.hxx b/lotuswordpro/inc/lwpfrib.hxx
new file mode 100644
index 000000000..9af56ab38
--- /dev/null
+++ b/lotuswordpro/inc/lwpfrib.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPFRIB_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPFRIB_HXX
+#include <map>
+#include <memory>
+#include <config_lgpl.h>
+#include "lwpobjid.hxx"
+#include "lwpobjstrm.hxx"
+#include "lwpoverride.hxx"
+#include "lwpfoundry.hxx"
+#include "xfilter/xfcolor.hxx"
+
+struct ModifierInfo
+{
+ sal_uInt32 FontID;
+ LwpObjectID CharStyleID;
+ LwpTextLanguageOverride Language;
+ LwpTextAttributeOverride aTxtAttrOverride;
+ sal_uInt16 CodePage;
+ bool HasCharStyle;
+ bool HasLangOverride;
+ bool HasHighlight;
+ sal_uInt8 RevisionType;
+ bool RevisionFlag;
+};
+
+class LwpPara;
+class LwpHyperlinkMgr;
+class LwpFrib
+{
+public:
+ explicit LwpFrib(LwpPara* pPara);
+ virtual ~LwpFrib();
+ static LwpFrib* CreateFrib(LwpPara* pPara, LwpObjectStream* pObjStrm, sal_uInt8 fribtag, sal_uInt8 editID);
+ virtual void Read(LwpObjectStream* pObjStrm, sal_uInt16 len);
+ LwpFrib* GetNext(){return m_pNext;}
+ void SetNext(LwpFrib* next){m_pNext = next;}
+ sal_uInt8 GetType() const { return m_nFribType;}
+ OUString GetEditor();
+ XFColor GetHighlightColor();
+protected:
+ std::map<LwpFrib*,OUString>* m_pFribMap;
+ LwpPara* m_pPara;
+ LwpFrib* m_pNext;
+ sal_uInt8 m_nFribType;
+ std::unique_ptr<ModifierInfo> m_pModifiers;
+ OUString m_StyleName;
+public:
+ bool m_ModFlag;
+ const OUString& GetStyleName() const {return m_StyleName;}
+ void SetModifiers(ModifierInfo* pModifiers);
+ ModifierInfo* GetModifiers(){return m_pModifiers.get();}
+ virtual void RegisterStyle(LwpFoundry* pFoundry);
+ bool HasNextFrib();
+ void ConvertChars(XFContentContainer* pXFPara,const OUString& text);
+ void ConvertHyperLink(XFContentContainer* pXFPara, const LwpHyperlinkMgr* pHyperlink,const OUString& text);
+ rtl::Reference<XFFont> GetFont();
+
+ sal_uInt8 GetRevisionType() const {return m_nRevisionType;}
+ bool GetRevisionFlag() const {return m_bRevisionFlag;}
+ enum{
+ REV_INSERT =0,
+ REV_DELETE = 1,
+ };
+
+ void Register(std::map<LwpFrib*,OUString>* pFribMap);
+ void Deregister();
+private:
+ static void ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo);
+protected:
+ sal_uInt8 m_nRevisionType;
+ bool m_bRevisionFlag;
+ sal_uInt8 m_nEditor;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpglobalmgr.hxx b/lotuswordpro/inc/lwpglobalmgr.hxx
new file mode 100644
index 000000000..9bfc5e3d6
--- /dev/null
+++ b/lotuswordpro/inc/lwpglobalmgr.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPGLOBALMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPGLOBALMGR_HXX
+
+#include <memory>
+#include <map>
+#include <config_lgpl.h>
+#include "lwpsvstream.hxx"
+#include "lwpobjfactory.hxx"
+#include "lwpbookmarkmgr.hxx"
+#include "lwpchangemgr.hxx"
+#include "xfilter/xffontfactory.hxx"
+#include "xfilter/xfstylemanager.hxx"
+#include "lwpdocdata.hxx"
+#include "xfilter/xfcolor.hxx"
+
+class LwpGlobalMgr
+{
+public:
+ ~LwpGlobalMgr();
+ static LwpGlobalMgr* GetInstance(LwpSvStream* pSvStream=nullptr);
+ static void DeleteInstance();
+ LwpObjectFactory* GetLwpObjFactory(){return m_pObjFactory.get();}
+ LwpBookmarkMgr* GetLwpBookmarkMgr(){return m_pBookmarkMgr.get();}
+ LwpChangeMgr* GetLwpChangeMgr(){return m_pChangeMgr.get();}
+ XFFontFactory* GetXFFontFactory(){return m_pXFFontFactory.get();}
+ XFStyleManager* GetXFStyleManager(){return m_pXFStyleManager.get();}
+ void SetEditorAttrMap(sal_uInt16 nID, LwpEditorAttr* pAttr);
+ OUString GetEditorName(sal_uInt8 nID);
+ XFColor GetHighlightColor(sal_uInt8 nID);
+private:
+ explicit LwpGlobalMgr(LwpSvStream* pSvStream);
+private:
+ static std::map< sal_uInt32,LwpGlobalMgr* > m_ThreadMap;
+ std::unique_ptr<LwpObjectFactory> m_pObjFactory;
+ std::unique_ptr<LwpBookmarkMgr> m_pBookmarkMgr;
+ std::unique_ptr<LwpChangeMgr> m_pChangeMgr;
+ std::unique_ptr<XFFontFactory> m_pXFFontFactory;
+ std::unique_ptr<XFStyleManager> m_pXFStyleManager;
+ std::map<sal_uInt16, std::unique_ptr<LwpEditorAttr>> m_EditorAttrMap;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpidxmgr.hxx b/lotuswordpro/inc/lwpidxmgr.hxx
new file mode 100644
index 000000000..e3165cdce
--- /dev/null
+++ b/lotuswordpro/inc/lwpidxmgr.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * index manager, to maintain the map between object id and offset
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPIDXMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPIDXMGR_HXX
+
+#include <config_lgpl.h>
+#include "lwpobjid.hxx"
+#include "lwpobjstrm.hxx"
+
+/**
+ * @brief key structure used to map id to offset
+*/
+struct LwpKey
+{
+ LwpObjectID id;
+ sal_uInt32 offset = 0;
+};
+
+/**
+ * @brief LwpIndexManager, to read all index records and maintain the index information
+*/
+class LwpIndexManager final
+{
+public:
+ LwpIndexManager();
+private:
+ static const sal_uInt8 MAXOBJECTIDS;
+ std::vector<LwpKey> m_ObjectKeys; //the <id, offset> ordered vector
+ std::vector<LwpKey> m_RootObjs; //For those object ids in RootObjIndex
+ std::vector<sal_uInt32> m_TimeTable; //Time table for object low id compression
+
+ //sal_uInt16 m_nKeyCount;
+ sal_uInt32 m_nKeyCount; //the count of all object
+ std::vector<sal_uInt32> m_TempVec; // a temp vector , store the offset of leafindex
+
+ sal_uInt32 m_ChildIndex[256]; //Offset of leaf index
+ sal_uInt16 m_nLeafCount;
+
+ void ReadRootData(LwpObjectStream *pObjStrm ); //Read root index data
+
+ //Add new method to handle ObjIndex
+ void ReadObjIndexData(LwpObjectStream* pObjStrm);
+ void ReadObjIndex( LwpSvStream *pStrm ); //Read Obj index
+
+ void ReadLeafIndex( LwpSvStream *pStrm ); //Read leaf index obj
+ void ReadLeafData( LwpObjectStream *pStrm ); //Read leaf index obj data
+ void ReadTimeTable( LwpObjectStream *pStrm );
+public:
+ void Read( LwpSvStream *pStrm );
+ sal_uInt32 GetObjOffset( LwpObjectID objid );
+ sal_uInt32 GetObjTime( sal_uInt16 index ) { return m_TimeTable.at(index-1); }
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpobj.hxx b/lotuswordpro/inc/lwpobj.hxx
new file mode 100644
index 000000000..e9b6c98fa
--- /dev/null
+++ b/lotuswordpro/inc/lwpobj.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+ /**
+ * @file
+ * Base class of all Lwp VO objects
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOBJ_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOBJ_HXX
+
+#include <memory>
+#include <sal/config.h>
+
+#include <stdexcept>
+
+#include <salhelper/simplereferenceobject.hxx>
+
+#include <config_lgpl.h>
+
+#include "lwpobjhdr.hxx"
+#include "lwpobjstrm.hxx"
+#include "xfilter/ixfstream.hxx"
+#include "xfilter/xfcontentcontainer.hxx"
+
+class LwpFoundry;
+/**
+ * @brief Base class of all Lwp VO objects
+*/
+class LwpObject: public salhelper::SimpleReferenceObject
+{
+public:
+ LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm);
+protected:
+ virtual ~LwpObject() override;
+ LwpObjectHeader m_ObjHdr;
+ std::unique_ptr<LwpObjectStream> m_pObjStrm;
+ LwpFoundry* m_pFoundry;
+ LwpSvStream* m_pStrm;
+ bool m_bRegisteringStyle;
+ bool m_bParsingStyle;
+ bool m_bConvertingContent;
+protected:
+ virtual void Read();
+ virtual void RegisterStyle();
+ virtual void Parse(IXFStream* pOutputStream);
+ virtual void XFConvert(XFContentContainer* pCont);
+public:
+ void QuickRead();
+ //calls RegisterStyle but bails if DoRegisterStyle is called
+ //on the same object recursively
+ void DoRegisterStyle()
+ {
+ if (m_bRegisteringStyle)
+ throw std::runtime_error("recursion in styles");
+ m_bRegisteringStyle = true;
+ RegisterStyle();
+ m_bRegisteringStyle = false;
+ }
+ //calls Parse but bails if DoParse is called
+ //on the same object recursively
+ void DoParse(IXFStream* pOutputStream)
+ {
+ if (m_bParsingStyle)
+ throw std::runtime_error("recursion in parsing");
+ m_bParsingStyle = true;
+ Parse(pOutputStream);
+ m_bParsingStyle = false;
+ }
+ //calls XFConvert but bails if DoXFConvert is called
+ //on the same object recursively
+ void DoXFConvert(XFContentContainer* pCont)
+ {
+ if (m_bConvertingContent)
+ throw std::runtime_error("recursion in parsing");
+ m_bConvertingContent = true;
+ XFConvert(pCont);
+ m_bConvertingContent = false;
+ }
+
+ LwpFoundry* GetFoundry(){return m_pFoundry;}
+ void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;}
+ LwpObjectID& GetObjectID(){ return m_ObjHdr.GetID();}
+ sal_uInt32 GetTag() const { return m_ObjHdr.GetTag();}
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpobjfactory.hxx b/lotuswordpro/inc/lwpobjfactory.hxx
new file mode 100644
index 000000000..b1d644b0d
--- /dev/null
+++ b/lotuswordpro/inc/lwpobjfactory.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOBJFACTORY_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOBJFACTORY_HXX
+
+#include <sal/config.h>
+
+#include <config_lgpl.h>
+
+#include <rtl/ref.hxx>
+
+#include "lwpobjid.hxx"
+#include "lwpobj.hxx"
+#include "lwpobjhdr.hxx"
+#include "lwpidxmgr.hxx"
+
+#include <unordered_map>
+#include <vector>
+
+/**
+ * @brief object factory used for lwp object creation and maintenance
+*/
+class LwpObjectFactory final
+{
+public:
+ explicit LwpObjectFactory(LwpSvStream* pSvStream);
+ ~LwpObjectFactory();
+
+//For object Factory and object manager
+private:
+ LwpSvStream* m_pSvStream;
+ std::vector<LwpObjectID> m_aObjsIDInCreation;
+ struct hashFunc
+ {
+ size_t operator()( const LwpObjectID& rName ) const
+ {
+ return rName.HashCode();
+ }
+ };
+ struct eqFunc
+ {
+ bool operator()( const LwpObjectID& rKey1, const LwpObjectID& rKey2 ) const
+ {
+ return(rKey1==rKey2);
+ }
+ };
+ typedef std::unordered_map<LwpObjectID, rtl::Reference<LwpObject>, hashFunc, eqFunc> LwpIdToObjMap;
+ LwpIdToObjMap m_IdToObjList;
+ LwpIndexManager m_IndexMgr;
+
+ rtl::Reference<LwpObject> FindObject(const LwpObjectID &objID);
+public:
+ rtl::Reference<LwpObject> CreateObject(sal_uInt32 type, LwpObjectHeader &objHdr);
+ rtl::Reference<LwpObject> QueryObject(const LwpObjectID &objID);
+ void ReleaseObject(const LwpObjectID &objID);
+ void ReadIndex(LwpSvStream* pStrm);
+ LwpIndexManager& GetIndexManager(){return m_IndexMgr;}
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpobjhdr.hxx b/lotuswordpro/inc/lwpobjhdr.hxx
new file mode 100644
index 000000000..e61b587f3
--- /dev/null
+++ b/lotuswordpro/inc/lwpobjhdr.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOBJHDR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOBJHDR_HXX
+
+#include <config_lgpl.h>
+#include "lwpobjid.hxx"
+
+/**
+ * @brief Base class of all Lwp VO objects
+*/
+class LwpObjectHeader
+{
+public:
+ LwpObjectHeader();
+private:
+ sal_uInt32 m_nTag;
+ LwpObjectID m_ID;
+ sal_uInt32 m_nSize; //Data size
+ bool m_bCompressed;
+
+ //localize the following members to save memory
+ //sal_uInt8 m_nFlagBits;
+ //sal_uInt32 m_nVersionID;
+ //sal_uInt32 m_nRefCount;
+ //sal_uInt32 m_nNextVersionOffset;
+ //sal_uInt32 m_nNextVersionID;
+ //sal_uInt32 m_nHeaderSize;
+
+ enum
+ {
+ VERSION_BITS = 0x03,
+ DEFAULT_VERSION = 0x00,
+ ONE_BYTE_VERSION = 0x01,
+ TWO_BYTE_VERSION = 0x02,
+ FOUR_BYTE_VERSION = 0x03,
+
+ REFCOUNT_BITS = 0x0C,
+ ONE_BYTE_REFCOUNT = 0x04,
+ TWO_BYTE_REFCOUNT = 0x08,
+ FOUR_BYTE_REFCOUNT = 0x0C,
+
+ SIZE_BITS = 0x30,
+ ONE_BYTE_SIZE = 0x10,
+ TWO_BYTE_SIZE = 0x20,
+ FOUR_BYTE_SIZE = 0x30,
+
+ HAS_PREVOFFSET = 0x40,
+ DATA_COMPRESSED = 0x80
+ };
+
+public:
+ bool Read(LwpSvStream &pStrm);
+ inline sal_uInt32 GetTag() const;
+ inline sal_uInt32 GetSize() const;
+ inline LwpObjectID& GetID();
+ inline bool IsCompressed() const;
+};
+
+inline sal_uInt32 LwpObjectHeader::GetTag() const
+{
+ return m_nTag;
+}
+inline sal_uInt32 LwpObjectHeader::GetSize() const
+{
+ return m_nSize;
+}
+inline LwpObjectID& LwpObjectHeader::GetID()
+{
+ return m_ID;
+}
+inline bool LwpObjectHeader::IsCompressed() const
+{
+ return m_bCompressed;
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpobjid.hxx b/lotuswordpro/inc/lwpobjid.hxx
new file mode 100644
index 000000000..b35e58450
--- /dev/null
+++ b/lotuswordpro/inc/lwpobjid.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOBJID_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOBJID_HXX
+
+#include <sal/config.h>
+
+#include <config_lgpl.h>
+
+#include <rtl/ref.hxx>
+
+#include "lwpobjstrm.hxx"
+#include "lwpdefs.hxx"
+
+class LwpObject;
+
+/**
+ * @brief object id class
+*/
+class LwpObjectID
+{
+public:
+ LwpObjectID();
+private:
+ sal_uInt32 m_nLow;
+ sal_uInt16 m_nHigh;
+ sal_uInt8 m_nIndex;
+ bool m_bIsCompressed;
+public:
+ void Read( LwpSvStream *pStrm );
+ sal_uInt32 Read( LwpObjectStream *pStrm );
+ void ReadIndexed( LwpSvStream* pStrm );
+ sal_uInt32 ReadIndexed( LwpObjectStream *pStrm );
+ void ReadCompressed( LwpObjectStream* pObj, LwpObjectID const & prev );
+
+ /**
+ * @descr return the size of object id with format: low(4bytes)+high(2bytes)
+ */
+ static sal_uInt32 DiskSize() { return sizeof(sal_uInt32) + sizeof(sal_uInt16); } // sizeof(m_nLow) + sizeof(m_nHigh)
+ sal_uInt32 DiskSizeIndexed() const;
+ bool IsNull() const;
+
+ sal_uInt32 GetLow() const ;
+ sal_uInt16 GetHigh() const ;
+
+ bool operator == (const LwpObjectID &Other) const;
+ bool operator != (const LwpObjectID &Other) const;
+ rtl::Reference<LwpObject> obj(VO_TYPE tag=VO_INVALID) const;
+ size_t HashCode() const;
+};
+
+inline bool LwpObjectID::IsNull() const
+{
+ return (m_nLow == 0) && (m_nHigh == 0);
+}
+
+inline bool LwpObjectID::operator == (const LwpObjectID &Other) const
+{
+ return (m_nHigh == Other.m_nHigh) && (m_nLow == Other.m_nLow);
+}
+
+inline bool LwpObjectID::operator != (const LwpObjectID &Other) const
+{
+ return (m_nHigh != Other.m_nHigh) || (m_nLow != Other.m_nLow);
+}
+
+inline sal_uInt32 LwpObjectID::GetLow() const
+{
+ return m_nLow;
+}
+
+inline sal_uInt16 LwpObjectID::GetHigh() const
+{
+ return m_nHigh;
+}
+
+inline size_t LwpObjectID::HashCode() const
+{
+ return static_cast<size_t>(
+ (m_nIndex == 0 ? 23 * m_nLow : 27 * m_nIndex) + 29 * m_nHigh);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpobjstrm.hxx b/lotuswordpro/inc/lwpobjstrm.hxx
new file mode 100644
index 000000000..adde15593
--- /dev/null
+++ b/lotuswordpro/inc/lwpobjstrm.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * object stream header file
+ * stream for one LwpObject body data
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOBJSTRM_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOBJSTRM_HXX
+
+#include <config_lgpl.h>
+
+#include <rtl/ustring.hxx>
+#include <vector>
+
+#include "lwpsvstream.hxx"
+
+/**
+ * @brief stream class for LwpObject body data
+ * provide stream like interface to read object data
+*/
+class LwpObjectStream
+{
+public:
+ LwpObjectStream(LwpSvStream *pStrm, bool isCompressed, sal_uInt16 size);
+ ~LwpObjectStream();
+private:
+ sal_uInt8* m_pContentBuf; //The content buffer of the object
+ sal_uInt8 m_SmallBuffer[100]; //To avoid frequent new
+ std::vector<sal_uInt8> m_BigBuffer; //otherwise use this
+ enum
+ {
+ IO_BUFFERSIZE = 0xFF00 //Refer to LWP, not sure if it is enough
+ };
+ sal_uInt16 m_nBufSize; //The total size of m_pContentBuf
+ sal_uInt16 m_nReadPos; //The position of the quick read
+ LwpSvStream* m_pStrm;
+ bool m_bCompressed;
+public:
+ sal_uInt16 remainingSize() const;
+ sal_uInt16 QuickRead(void* buf, sal_uInt16 len);
+ sal_uInt16 GetPos() const { return m_nReadPos; }
+ void SeekRel(sal_uInt16 pos);
+ void Seek( sal_uInt16 pos);
+ void SkipExtra();
+ sal_uInt16 CheckExtra();
+
+ bool QuickReadBool();
+ sal_uInt32 QuickReaduInt32(bool *pFailure=nullptr);
+ sal_uInt16 QuickReaduInt16(bool *pFailure=nullptr);
+ sal_uInt8 QuickReaduInt8(bool *pFailure=nullptr);
+ sal_Int32 QuickReadInt32();
+ sal_Int16 QuickReadInt16();
+ double QuickReadDouble();
+
+ OUString QuickReadStringPtr();
+
+ void ReadComplete();
+ LwpSvStream *GetStream();
+private:
+ void Read2Buffer();
+ sal_uInt8* AllocBuffer(sal_uInt16 size);
+ static sal_uInt16 DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, sal_uInt16 Size);
+ void ReleaseBuffer();
+};
+
+inline LwpSvStream *LwpObjectStream::GetStream()
+{
+ return m_pStrm;
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpobjtags.hxx b/lotuswordpro/inc/lwpobjtags.hxx
new file mode 100644
index 000000000..9d011c338
--- /dev/null
+++ b/lotuswordpro/inc/lwpobjtags.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOBJTAGS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOBJTAGS_HXX
+
+// file header object
+#define TAG_AMI 0x3750574CUL // "LWP7"
+
+// layout sub-objects
+#define TAG_ENDSUBOBJ 0x646E4553UL // "SEnd"
+#define TAG_LAY_GEOMETRY 0x6F65474CUL // "LGeo"
+#define TAG_LAY_OFFSET 0x66664F4CUL // "LOff"
+#define TAG_LAY_SCALE 0x6C63534CUL // "LScl"
+#define TAG_LAY_MARGINS 0x72614D4CUL // "LMar"
+#define TAG_LAY_RELATIVITY 0x6C65524CUL // "LRel"
+#define TAG_LAY_COLUMNS 0x6C6F434CUL // "LCol"
+#define TAG_LAY_BORDER 0x726F424CUL // "LBor"
+#define TAG_LAY_GUTTER 0x7475474CUL // "LGut"
+#define TAG_LAY_JOIN 0x696F4A4CUL // "LJoi"
+#define TAG_LAY_BACKGROUND 0x6B63424CUL // "LBck"
+#define TAG_LAY_SHADOW 0x7764534CUL // "LSdw"
+#define TAG_LAY_LEADERDOTS 0x72644C4CUL // "LLdr"
+#define TAG_LAY_NUMERICS 0x6D754E4CUL // "LNum"
+#define TAG_LAY_HIERARCHY 0x6569484CUL // "LHie"
+
+// Paragraph properties
+#define TAG_PARA_SHOW 0x65644850UL // "PHde"
+#define TAG_PARA_HIDE 0x77685350UL // "PShw"
+#define TAG_PARA_ALIGN 0x6e6c4150UL // "PAln"
+#define TAG_PARA_INDENT 0x74644950UL // "PIdt"
+#define TAG_PARA_SPACING 0x63705350UL // "PSpc"
+#define TAG_PARA_BORDER 0x64724250UL // "PBrd"
+#define TAG_PARA_BACKGROUND 0x6b614250UL // "PBak"
+#define TAG_PARA_BREAKS 0x6b724250UL // "PBrk"
+#define TAG_PARA_BULLET 0x746c4250UL // "PBlt"
+#define TAG_PARA_NUMBERING 0x6d754e50UL // "PNum"
+#define TAG_PARA_TAB 0x62615450UL // "PTab"
+#define TAG_PARA_KINSOKU 0x6e694b50UL // "PKin"
+#define TAG_PARA_PROPLIST 0x70725050UL // "PPrp"
+
+#define TAG_SLVLIST 0x734C4C53UL // "SLLs"
+#define TAG_DLFVLIST 0x4C464C44UL // "DLFL"
+#define TAG_DLVLISTHEAD 0x64484C44UL // "DLHd"
+#define TAG_DLNFVLIST 0x464E4C44UL // "DLNF"
+#define TAG_DLVLIST 0x734C4C44UL // "DLLs"
+
+#define TAG_DOCUMENT 0x20636F44UL // "Doc "
+#define TAG_VERDOCUMENT 0x636F4456UL // "VDoc"
+#define TAG_DOCDATA 0x44636F44UL // "DocD"
+#define TAG_OBJINDEX 0x78644E4FUL // "ONdx"
+#define TAG_DIVISIONINFO 0x49766944UL // "DivI"
+#define TAG_CONTENT 0x746E6F43UL // "Cont"
+#define TAG_HEADCONTENT 0x746E4348UL // "HCnt"
+#define TAG_STORY 0x79727453UL // "Stry"
+#define TAG_TABLE 0x6C626154UL // "Tabl"
+#define TAG_SUPERTABLE 0x62547553UL // "SuTb"
+#define TAG_GLOSSARY 0x736F6C47UL // "Glos"
+#define TAG_PARALLELCOLUMNS 0x6C6F4350UL // "PCol"
+#define TAG_PARALLELCOLUMNSLAYOUT 0x794C4350UL // "PCLy"
+#define TAG_PARALLELCOLUMNSBLOCK 0x6C424350UL // "PCBl"
+#define TAG_PARALLELCOLUMNSCONNECTEDBLOCK 0x42434350UL // "PCCB"
+#define TAG_FOOTNOTETABLE 0x62546E46UL // "FnTb"
+#define TAG_PARAGRAPH 0x61726150UL // "Para"
+#define TAG_BOOKMARK 0x6B4D6B42UL // "BkMk"
+#define TAG_DDELINK 0x4C656444UL // "DdeL"
+#define TAG_VIRTUALLAYOUT 0x79614C56UL // "VLay"
+#define TAG_LITELAYOUT 0x79614C4CUL // "LLay"
+#define TAG_LAYOUT 0x2079614CUL // "Lay "
+#define TAG_PERMISSIVELAYOUT 0x79614C50UL // "PLay"
+#define TAG_HEADLAYOUT 0x79614C48UL // "HLay"
+#define TAG_FRAMELAYOUT 0x6D617246UL // "Fram"
+#define TAG_DROPCAPLAYOUT 0x70614344UL // "DCap"
+#define TAG_NOTELAYOUT 0x794C744EUL // "NtLy"
+#define TAG_NOTETEXTLAYOUT 0x6C54744EUL // "NtTl"
+#define TAG_NOTEHEADERLAYOUT 0x6C48744EUL // "NtHl"
+#define TAG_PAGELAYOUT 0x65676150UL // "Page"
+#define TAG_HEADERLAYOUT 0x4C726448UL // "HdrL"
+#define TAG_FOOTERLAYOUT 0x4C727446UL // "FtrL"
+#define TAG_ROWLAYOUT 0x4C776F52UL // "RowL"
+#define TAG_COLUMNLAYOUT 0x4C6C6F43UL // "ColL"
+#define TAG_FNROWLAYOUT 0x4C526E46UL // "FnRL"
+#define TAG_CELLLAYOUT 0x4C6C6543UL // "CelL"
+#define TAG_VIEWPORTLAYOUT 0x794C7056UL // "VpLy"
+#define TAG_CONNECTEDCELLLAYOUT 0x4C436E43UL // "CnCL"
+#define TAG_HIDDENCELLLAYOUT 0x4C436E48UL // "HnCL"
+#define TAG_TABLEHEADINGLAYOUT 0x4C486254UL // "TbHL"
+#define TAG_ROWHEADINGLAYOUT 0x4C486F52UL // "RoHL"
+#define TAG_FNCELLLAYOUT 0x4C436E46UL // "FnCL"
+#define TAG_FOOTNOTELAYOUT 0x794C6E46UL // "FnLy"
+#define TAG_TABLELAYOUT 0x794C6254UL // "TbLy"
+#define TAG_SUPERTABLELAYOUT 0x4C625453UL // "STbL"
+#define TAG_FNSUPERTABLELAYOUT 0x4C545346UL // "FSTL"
+#define TAG_ENSUPERTABLELAYOUT 0x4C545345UL // "ESTL"
+#define TAG_SUPERPARALLELCOLUMNLAYOUT 0x4C435053UL // "SPCL"
+#define TAG_SUPERGLOSSARYLAYOUT 0x534C4753UL // "SGLS"
+#define TAG_CONTONLAYOUT 0x4C6E4F43UL // "COnL"
+#define TAG_CONTFROMLAYOUT 0x4C724643UL // "CFrL"
+#define TAG_CHARSTYLE 0x79745343UL // "CSty"
+#define TAG_PARASTYLE 0x79745350UL // "PSty"
+#define TAG_TABRACK 0x20626154UL // "Tab "
+#define TAG_GROUPLAYOUT 0x4c707247UL // "GrpL"
+#define TAG_GROUPFRAME 0x46707247UL // "GrpF"
+#define TAG_SILVERBULLET 0x6c754253UL // "SBul"
+#define TAG_TABLEHEADING 0x486c6254UL // "TblH"
+#define TAG_LINEHINT 0x746e484cUL // "LHnt"
+#define TAG_TABLEHINT 0x746e4854UL // "THnt"
+#define TAG_PAGEHINT 0x746e4850UL // "PHnt"
+#define TAG_NUMBERHINT 0x746e484EUL // "NHnt"
+#define TAG_FOOTNOTESEEN 0x65655346UL // "FSee"
+#define TAG_OBJECTHOLDER 0x646c6F48UL // "Hold"
+#define TAG_LISTLIST 0x744c744cUL // "LtLt"
+#define TAG_FOOTNOTELISTLIST 0x744c7446UL // "FtLt"
+#define TAG_ENDNOTELAYOUT 0x794C6E45UL // "EnLy"
+#define TAG_FOOTNOTE 0x746F4E46UL // "FNot"
+#define TAG_CELLNUMBERHINT 0x74486e43UL // "CnHt"
+#define TAG_MARKER 0x6b72614DUL // "Mark"
+#define TAG_STORYMARKER 0x6b724d53UL // "SMrk"
+#define TAG_TABLEMARKER 0x6b724d54UL // "TMrk"
+#define TAG_FIELDMARKER 0x4c724d54UL // "FMrk"
+#define TAG_NUMERICVALUE 0x6c61564eUL // "NVal"
+#define TAG_TEXTVALUE 0x6c615654UL // "TVal"
+#define TAG_REFERENCEVALUE 0x6c615652UL // "RVal"
+#define TAG_CELLLIST 0x64734c43UL // "CLst"
+#define TAG_DEPENDENT 0x74647044UL // "Dpdt"
+#define TAG_FORMULAINFO 0x616c7246UL // "Frla"
+#define TAG_TABLERANGE 0x676e5254UL // "TRng"
+#define TAG_CELLRANGE 0x676e5243UL // "CRng"
+#define TAG_FOLDER 0x726c6446UL // "Fldr"
+#define TAG_ROWLIST 0x74734c52UL // "RLst"
+#define TAG_SECTION 0x74636553UL // "Sect"
+#define TAG_INDEXSECTION 0x63657349UL // "Isec"
+#define TAG_GRAPHIC 0x68707247UL // "Grph"
+#define TAG_DIRTBAG 0x74726944UL // "Dirt"
+#define TAG_NAMEDOUTLINESEQ 0x71534f4eUL // "NOSq"
+#define TAG_OUTLINESEQITEM 0x7449534fUL // "OSIt"
+#define TAG_TOCSUPERTABLELAYOUT 0x6C747354UL // "Tstl"
+#define TAG_DOCSOCKET 0x786F5344UL // "DSox"
+#define TAG_USER_VERSION 0x72655655UL // "UVer"
+#define TAG_NOTE 0x65746F4EUL // "Note"
+#define TAG_MARKERLIST 0x74734c4dUL // "MLst"
+#define TAG_BOOKMARKMARKERLIST 0x744c4d42UL // "BMLt"
+#define TAG_DDEMARKMARKERLIST 0x744c4d44UL // "DMLt"
+#define TAG_FIELDMARKERLIST 0x744c6c46UL // "FlLt"
+#define TAG_CHBLKMARKER 0x6b4d4843UL // "CHMk"
+#define TAG_CHBMARKERLIST 0x424d4c43UL // "CMLt"
+#define TAG_PPTRHOLDER 0x72745070UL // "pPtr"
+#define TAG_QPTRHOLDER 0x72745071UL // "qPtr"
+#define TAG_GPTRHOLDER 0x72745067UL // "gPtr"
+#define TAG_PROPLIST 0x706f7250UL // "Prop"
+#define TAG_HEADHOLDER 0x646C4848UL // "HHld"
+#define TAG_HEADTAILHOLDER 0x72485448UL // "HTHr"
+#define TAG_OLEOBJECT 0x4F656C4FUL // "OleO"
+#define TAG_ENUMOBJHD 0x64484F45UL // "EOHd"
+#define TAG_TOCLEVELDATA 0x4C6f6354UL // "TocL"
+#define TAG_VERPTR 0x72745056UL // "VPtr"
+#define TAG_VERQTR 0x72745156UL // "VQtr"
+#define TAG_VERDOCINFO 0x6E494456UL // "VDIn"
+#define TAG_TOMBSTONE 0x20504952UL // "RIP "
+#define TAG_NOTIFY 0x7966744EUL // "Ntfy"
+#define TAG_LONGHOLDER 0x676E6F4CUL // "Long"
+
+#define TAG_DIVOPTS 0x74704f44UL // "DOpt"
+#define TAG_FOOTNOTEOPTS 0x704f4e46UL // "FNOp"
+
+#ifdef RUBY
+#define TAG_RUBYLAYOUT 0x794C6252UL // "RbLy"
+#define TAG_RUBYMARKER 0x6b724d52UL // "RMrk"
+#define TAG_RUBYMARKERLIST 0x744c6252UL // "RbLt"
+#endif
+
+#define TAG_ALIGNMENTPIECE 0x63506c41UL // "AlPc"
+#define TAG_INDENTPIECE 0x63506e49UL // "InPc"
+#define TAG_PARABORDERPIECE 0x63504250UL // "PBPc"
+#define TAG_PARABACKGROUNDPIECE 0x63505250UL // "PRPc"
+#define TAG_SPACINGPIECE 0x63507053UL // "SpPc"
+#define TAG_BREAKSPIECE 0x63507242UL // "BrPc"
+#define TAG_NUMBERINGPIECE 0x6350724eUL // "NrPc"
+#define TAG_CHARBORDERPIECE 0x63504243UL // "CBPc"
+#define TAG_AMIKAKEPIECE 0x63504b41UL // "AKPc"
+#define TAG_TABPIECE 0x63506254UL // "TbPc"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpoverride.hxx b/lotuswordpro/inc/lwpoverride.hxx
new file mode 100644
index 000000000..036492e51
--- /dev/null
+++ b/lotuswordpro/inc/lwpoverride.hxx
@@ -0,0 +1,483 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPOVERRIDE_HXX
+
+#include "lwpobjid.hxx"
+#include "lwptools.hxx"
+#include <o3tl/safeint.hxx>
+#include <memory>
+
+class LwpObjectStream;
+
+enum STATE
+{
+ STATE_OFF = 0,
+ STATE_ON = 1,
+ STATE_STYLE = 2
+};
+
+class LwpOverride
+{
+public:
+ LwpOverride() : m_nValues(0), m_nOverride(0), m_nApply(0) {}
+
+ virtual ~LwpOverride(){}
+
+ virtual LwpOverride* clone() const = 0;
+
+ virtual void Read(LwpObjectStream* pStrm) = 0;
+
+ void ReadCommon(LwpObjectStream* pStrm);
+
+ void Clear();
+
+ void Override(sal_uInt16 nBits, STATE eState);
+
+protected:
+ explicit LwpOverride(LwpOverride const& rOther);
+
+private:
+ LwpOverride& operator=(LwpOverride const& rOther) = delete;
+
+protected:
+ sal_uInt16 m_nValues;
+ sal_uInt16 m_nOverride;
+ sal_uInt16 m_nApply;
+};
+
+class LwpTextLanguageOverride final : public LwpOverride
+{
+public:
+ LwpTextLanguageOverride() : m_nLanguage(0) {}
+
+ virtual LwpTextLanguageOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+private:
+ LwpTextLanguageOverride(LwpTextLanguageOverride const& rOther);
+ LwpTextLanguageOverride& operator=(LwpTextLanguageOverride const& rOther) = delete;
+
+ sal_uInt16 m_nLanguage;
+};
+
+class LwpTextAttributeOverride final : public LwpOverride
+{
+public:
+ LwpTextAttributeOverride() : m_nHideLevels(0), m_nBaseLineOffset(0) {}
+
+ virtual LwpTextAttributeOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+ inline sal_uInt16 GetHideLevels() const;
+
+ bool IsHighlight() const;
+
+private:
+ LwpTextAttributeOverride(LwpTextAttributeOverride const& rOther);
+ LwpTextAttributeOverride& operator=(LwpTextAttributeOverride const& rOther) = delete;
+
+ enum{
+ TAO_HIGHLIGHT = 0x08,
+ };
+ sal_uInt16 m_nHideLevels;
+ sal_uInt32 m_nBaseLineOffset;
+};
+
+inline sal_uInt16 LwpTextAttributeOverride::GetHideLevels() const
+{
+ return m_nHideLevels;
+}
+
+class LwpKinsokuOptsOverride final : public LwpOverride
+{
+public:
+ LwpKinsokuOptsOverride() : m_nLevels(0) {}
+
+ virtual LwpKinsokuOptsOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+private:
+ LwpKinsokuOptsOverride(LwpKinsokuOptsOverride const& rOther);
+ LwpKinsokuOptsOverride& operator=(LwpKinsokuOptsOverride const& rOther) = delete;
+
+ sal_uInt16 m_nLevels;
+};
+
+class LwpBulletOverride final : public LwpOverride
+{
+public:
+ LwpBulletOverride() {m_bIsNull = true;}
+
+ virtual LwpBulletOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+ inline const LwpObjectID& GetSilverBullet() const;
+
+ void Override(LwpBulletOverride* pOther);
+
+ inline bool IsSilverBulletOverridden() const;
+ inline bool IsSkipOverridden() const;
+ inline bool IsRightAlignedOverridden() const;
+ inline bool IsSkip() const;
+ inline bool IsRightAligned() const;
+ inline bool IsEditable() const;
+
+ void OverrideSilverBullet(LwpObjectID aID);
+ void OverrideSkip(bool bOver);
+ void OverrideRightAligned(bool bOver);
+
+ inline void RevertSilverBullet();
+ inline void RevertSkip();
+ inline void RevertRightAligned();
+
+ bool IsInValid() const {return m_bIsNull;}
+
+private:
+ LwpBulletOverride(LwpBulletOverride const& rOther);
+ LwpBulletOverride& operator=(LwpBulletOverride const& rOther) = delete;
+
+ enum
+ {
+ BO_SILVERBULLET = 0x01,
+ // 0x02 is free
+ BO_RIGHTALIGN = 0x04,
+ BO_EDITABLE = 0x08,
+ BO_SKIP = 0x10
+ };
+
+ LwpObjectID m_SilverBullet;
+ bool m_bIsNull;
+};
+
+inline const LwpObjectID& LwpBulletOverride::GetSilverBullet() const
+{
+ return m_SilverBullet;
+}
+
+inline bool LwpBulletOverride::IsSilverBulletOverridden() const
+{
+ return ((m_nOverride & BO_SILVERBULLET) != 0);
+}
+
+inline bool LwpBulletOverride::IsSkipOverridden() const
+{
+ return ((m_nOverride & BO_SKIP) != 0);
+}
+
+inline bool LwpBulletOverride::IsRightAlignedOverridden() const
+{
+ return ((m_nOverride & BO_RIGHTALIGN) != 0);
+}
+
+inline bool LwpBulletOverride::IsSkip() const
+{
+ return ((m_nValues & BO_SKIP) != 0);
+}
+
+inline bool LwpBulletOverride::IsEditable() const
+{
+ return ((m_nValues & BO_EDITABLE) != 0);
+}
+
+inline bool LwpBulletOverride::IsRightAligned() const
+{
+ return ((m_nValues & BO_RIGHTALIGN) != 0);
+}
+
+inline void LwpBulletOverride::RevertSilverBullet()
+{
+ LwpOverride::Override(BO_SILVERBULLET, STATE_STYLE);
+}
+
+inline void LwpBulletOverride::RevertSkip()
+{
+ LwpOverride::Override(BO_SKIP, STATE_STYLE);
+}
+
+inline void LwpBulletOverride::RevertRightAligned()
+{
+ LwpOverride::Override(BO_RIGHTALIGN, STATE_STYLE);
+}
+
+class LwpAlignmentOverride final : public LwpOverride
+{
+public:
+ LwpAlignmentOverride() : m_nAlignType(ALIGN_LEFT), m_nPosition(0), m_nAlignChar(0){}
+
+ virtual LwpAlignmentOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+ enum AlignType
+ {
+ ALIGN_LEFT = 0,
+ ALIGN_RIGHT = 1,
+ ALIGN_CENTER = 2,
+ ALIGN_JUSTIFY = 3,
+ ALIGN_JUSTIFYALL = 4,
+ ALIGN_NUMERICLEFT = 5,
+ ALIGN_NUMERICRIGHT = 6,
+ ALIGN_SQUEEZE = 7
+ };
+
+ AlignType GetAlignType() const { return m_nAlignType; }
+ void Override(LwpAlignmentOverride* other);
+ void OverrideAlignment(AlignType val);
+
+private:
+ LwpAlignmentOverride(LwpAlignmentOverride const& rOther);
+ LwpAlignmentOverride& operator=(LwpAlignmentOverride const& rOther) = delete;
+
+ enum
+ {
+ AO_TYPE = 0x01,
+ AO_POSITION = 0x02,
+ AO_CHAR = 0x04
+ };
+
+ AlignType m_nAlignType;
+ sal_uInt32 m_nPosition;
+ sal_uInt16 m_nAlignChar;
+};
+
+class LwpSpacingCommonOverride final : public LwpOverride
+{
+public:
+ LwpSpacingCommonOverride() : m_nSpacingType(SPACING_NONE), m_nAmount(0), m_nMultiple(65536){}
+
+ virtual LwpSpacingCommonOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+ enum SpacingType
+ {
+ SPACING_DYNAMIC = 0,
+ SPACING_LEADING = 1,
+ SPACING_CUSTOM = 2,
+ SPACING_NONE = 3
+ };
+
+ SpacingType GetType() const {return m_nSpacingType;}
+ sal_Int32 GetAmount() const {return m_nAmount;}
+ sal_Int32 GetMultiple() const {return m_nMultiple;}
+
+ void Override(LwpSpacingCommonOverride* other);
+ void OverrideType(SpacingType val);
+ void OverrideAmount(sal_Int32 val);
+ void OverrideMultiple(sal_Int32 val);
+
+private:
+ LwpSpacingCommonOverride(LwpSpacingCommonOverride const& rOther);
+ LwpSpacingCommonOverride& operator=(LwpSpacingCommonOverride const& rOther) = delete;
+
+ enum
+ {
+ SPO_TYPE = 0x01,
+ SPO_AMOUNT = 0x02,
+ SPO_MULTIPLE= 0x04
+ };
+ SpacingType m_nSpacingType;//sal_uInt16
+ sal_Int32 m_nAmount;
+ sal_Int32 m_nMultiple;
+};
+
+class LwpSpacingOverride final : public LwpOverride
+{
+public:
+ LwpSpacingOverride();
+ virtual ~LwpSpacingOverride() override;
+
+ virtual LwpSpacingOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+ void Override(LwpSpacingOverride* other);
+
+ LwpSpacingCommonOverride* GetSpacing(){return m_pSpacing.get();}
+ LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing.get();}
+ LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove.get();}
+ LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow.get();}
+
+private:
+ LwpSpacingOverride(LwpSpacingOverride const& rOther);
+ LwpSpacingOverride& operator=(LwpSpacingOverride const& rOther) = delete;
+
+ std::unique_ptr<LwpSpacingCommonOverride> m_pSpacing;
+ std::unique_ptr<LwpSpacingCommonOverride> m_pAboveLineSpacing;
+ std::unique_ptr<LwpSpacingCommonOverride> m_pParaSpacingAbove;
+ std::unique_ptr<LwpSpacingCommonOverride> m_pParaSpacingBelow;
+};
+
+class LwpIndentOverride final : public LwpOverride
+{
+public:
+ LwpIndentOverride() : m_nAll(0), m_nFirst(0), m_nRest(0), m_nRight(0) {}
+
+ virtual LwpIndentOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+ enum
+ {
+ RELATIVE_FIRST, RELATIVE_REST, RELATIVE_ALL
+ };
+
+ inline double GetFirst() const;
+ inline double GetLeft() const;
+ inline double GetRight() const;
+
+ sal_uInt16 GetRelative() const;
+ bool IsUseRelative() const;
+ void Override(LwpIndentOverride* other);
+ void OverrideIndentAll(sal_Int32 val);
+ void OverrideIndentFirst(sal_Int32 val);
+ void OverrideIndentRight(sal_Int32 val);
+ void OverrideIndentRest(sal_Int32 val);
+ void OverrideUseRelative(bool use);
+ void OverrideRelative(sal_uInt16 relative);
+ sal_Int32 GetMAll() const {return m_nAll;}
+ sal_Int32 GetMFirst() const {return m_nFirst;}
+ sal_Int32 GetMRest() const {return m_nRest;}
+ sal_Int32 GetMRight() const {return m_nRight;}
+ void SetMAll(sal_Int32 val){m_nAll=val;}
+ void SetMFirst(sal_Int32 val){m_nFirst=val;}
+ void SetMRest(sal_Int32 val){m_nRest=val;}
+ void SetMRight(sal_Int32 val){m_nRight=val;}
+
+private:
+ LwpIndentOverride(LwpIndentOverride const& rOther);
+ LwpIndentOverride& operator=(LwpIndentOverride const& rOther) = delete;
+
+ enum
+ {
+ IO_ALL = 0x0001,
+ IO_FIRST = 0x0002,
+ IO_REST = 0x0004,
+ IO_RIGHT = 0x0008,
+ IO_HANGING = 0x0010,
+ IO_EQUAL = 0x0020,
+ IO_BODY = 0x0040,
+ IO_REL_ALL = 0x0080,
+ IO_REL_FIRST = 0x0100,
+ IO_REL_REST = 0x0200,
+ IO_REL_FLAGS = (IO_REL_ALL | IO_REL_FIRST | IO_REL_REST),
+ IO_USE_RELATIVE = 0x0400
+ };
+
+ sal_Int32 m_nAll;
+ sal_Int32 m_nFirst;
+ sal_Int32 m_nRest;
+ sal_Int32 m_nRight;
+};
+
+inline double LwpIndentOverride::GetFirst() const
+{
+ sal_Int32 nRes;
+ if (o3tl::checked_sub(m_nFirst, m_nRest, nRes))
+ throw std::range_error("bad len");
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(nRes));
+}
+inline double LwpIndentOverride::GetLeft() const
+{
+ sal_Int32 nRes;
+ if (o3tl::checked_add(m_nAll, m_nRest, nRes))
+ throw std::range_error("bad len");
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(nRes));
+}
+inline double LwpIndentOverride::GetRight() const
+{
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nRight));
+}
+
+class LwpBackgroundStuff;
+class LwpAmikakeOverride final : public LwpOverride
+{
+public:
+ LwpAmikakeOverride();
+
+ virtual ~LwpAmikakeOverride() override;
+
+ virtual LwpAmikakeOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+ enum
+ {
+ AMIKAKE_NONE = 0,
+ AMIKAKE_BACKGROUND = 1,
+ AMIKAKE_CHARACTER = 2
+ };
+
+private:
+ LwpAmikakeOverride(LwpAmikakeOverride const& rOther);
+ LwpAmikakeOverride& operator=(LwpAmikakeOverride const& rOther) = delete;
+
+ std::unique_ptr<LwpBackgroundStuff> m_pBackgroundStuff;
+ sal_uInt16 m_nType;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwpsvstream.hxx b/lotuswordpro/inc/lwpsvstream.hxx
new file mode 100644
index 000000000..445c2df5d
--- /dev/null
+++ b/lotuswordpro/inc/lwpsvstream.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPSVSTREAM_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPSVSTREAM_HXX
+
+#include <config_lgpl.h>
+
+#include <sal/types.h>
+
+class SvStream;
+
+/**
+ * @brief encapsulate XInputStream to provide SvStream like interfaces
+*/
+class LwpSvStream
+{
+public:
+ LwpSvStream(SvStream* pStream, LwpSvStream * pCompressed = nullptr);
+ size_t Read(void* bytes, size_t nBytesToRead);
+ void SeekRel(sal_Int64 pos);
+ sal_Int64 Tell();
+ sal_Int64 Seek(sal_Int64 pos);
+ bool CheckSeek(sal_Int64 pos);
+
+ LwpSvStream& ReadUInt8( sal_uInt8& rUInt8 );
+ LwpSvStream& ReadUInt16( sal_uInt16& rUInt16 );
+ LwpSvStream& ReadUInt32( sal_uInt32& rUInt32 );
+
+ static const sal_uInt32 LWP_STREAM_BASE;
+
+ LwpSvStream * GetCompressedStream()
+ {
+ return m_pCompressedStream;
+ };
+ SvStream * GetStream()
+ {
+ return m_pStream;
+ }
+
+private:
+ // when the file opened is small file, m_pStream is the decompressed stream
+ // when not, m_pStream contains the normal stream
+ SvStream* m_pStream;
+
+ // when the file opened is small file, this stream is for saving the
+ // compressed stream which is to be used for Chart/OLE as BENTO container
+ LwpSvStream * m_pCompressedStream;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/lwptools.hxx b/lotuswordpro/inc/lwptools.hxx
new file mode 100644
index 000000000..7a360cdda
--- /dev/null
+++ b/lotuswordpro/inc/lwptools.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * to provide basic utilities for word pro filter
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPTOOLS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_LWPTOOLS_HXX
+
+#include <config_lgpl.h>
+
+#include "lwpobjstrm.hxx"
+#include "localtime.hxx"
+#include "xfilter/xfdatestyle.hxx"
+#include "xfilter/xftimestyle.hxx"
+#include <rtl/textenc.h>
+#include <stdexcept>
+
+// 01/19/2005
+const sal_uInt32 UNITS_PER_INCH = 65536L * 72L;
+const double CM_PER_INCH = 2.54;
+const double INCHT_PER_CM = 1.0 / CM_PER_INCH;
+//end
+
+const double POINTS_PER_INCH = 72.27;
+const double TWIPS_PER_POINT = 20.0;
+const double TWIPS_PER_INCH = TWIPS_PER_POINT * POINTS_PER_INCH;
+const double TWIPS_PER_CM = TWIPS_PER_INCH/CM_PER_INCH;
+/**
+ * @brief tool class (unicode, conversion) for lwp filter.
+*/
+class LwpTools
+{
+
+public:
+ static void QuickReadUnicode( LwpObjectStream* pObjStrm,
+ OUString& str, sal_uInt16 strlen, rtl_TextEncoding aEncoding );
+ static bool IsUnicodePacked(LwpObjectStream* pObjStrm, sal_uInt16 len);
+
+ inline static double ConvertFromUnits(sal_Int32 nUnits);
+ inline static double ConvertToMetric(double fInch);
+ inline static double ConvertFromUnitsToMetric(sal_Int32 nUnits);
+
+ inline static bool IsOddNumber(sal_uInt16 nNumber);
+ inline static bool IsEvenNumber(sal_uInt16 nNumber);
+
+ static bool isFileUrl(const OString& fileName);
+ static OUString convertToFileUrl(const OString& fileName);
+ static OUString DateTimeToOUString(const LtTm& dt);
+
+ static std::unique_ptr<XFDateStyle> GetSystemDateStyle(bool bLongFormat);
+ static std::unique_ptr<XFTimeStyle> GetSystemTimeStyle();
+};
+
+inline double LwpTools::ConvertFromUnits(sal_Int32 nUnits)
+{
+ return static_cast<double>(nUnits)/UNITS_PER_INCH;
+}
+inline double LwpTools::ConvertToMetric(double fInch)
+{
+ return fInch*CM_PER_INCH;
+}
+inline double LwpTools::ConvertFromUnitsToMetric(sal_Int32 nUnits)
+{
+ double fInch = ConvertFromUnits(nUnits);
+ return ConvertToMetric(fInch);
+}
+inline bool LwpTools::IsOddNumber(sal_uInt16 nNumber)
+{
+ return (nNumber%2) != 0;
+}
+inline bool LwpTools::IsEvenNumber(sal_uInt16 nNumber)
+{
+ return (nNumber%2) == 0;
+}
+
+class BadSeek : public std::runtime_error
+{
+public:
+ BadSeek() : std::runtime_error("Lotus Word Pro Bad Seek") { }
+};
+
+class BadRead: public std::runtime_error
+{
+public:
+ BadRead() : std::runtime_error("Lotus Word Pro Bad Read") { }
+};
+
+class BadDecompress : public std::runtime_error
+{
+public:
+ BadDecompress() : std::runtime_error("Lotus Word Pro Bad Decompress") { }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/pch/precompiled_lwpft.cxx b/lotuswordpro/inc/pch/precompiled_lwpft.cxx
new file mode 100644
index 000000000..2f3866c72
--- /dev/null
+++ b/lotuswordpro/inc/pch/precompiled_lwpft.cxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "precompiled_lwpft.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/pch/precompiled_lwpft.hxx b/lotuswordpro/inc/pch/precompiled_lwpft.hxx
new file mode 100644
index 000000000..2135f0b3d
--- /dev/null
+++ b/lotuswordpro/inc/pch/precompiled_lwpft.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ This file has been autogenerated by update_pch.sh. It is possible to edit it
+ manually (such as when an include file has been moved/renamed/removed). All such
+ manual changes will be rewritten by the next run of update_pch.sh (which presumably
+ also fixes all possible problems, so it's usually better to use it).
+
+ Generated on 2020-02-01 10:57:44 using:
+ ./bin/update_pch lotuswordpro lwpft --cutoff=2 --exclude:system --exclude:module --exclude:local
+
+ If after updating build fails, use the following command to locate conflicting headers:
+ ./bin/update_pch_bisect ./lotuswordpro/inc/pch/precompiled_lwpft.hxx "make lotuswordpro.build" --find-conflicts
+*/
+
+#if PCH_LEVEL >= 1
+#include <algorithm>
+#include <assert.h>
+#include <cassert>
+#include <cstddef>
+#include <cstring>
+#include <limits>
+#include <memory>
+#include <new>
+#include <ostream>
+#include <stddef.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <string.h>
+#include <string_view>
+#include <type_traits>
+#include <utility>
+#include <vector>
+#include <boost/cast.hpp>
+#endif // PCH_LEVEL >= 1
+#if PCH_LEVEL >= 2
+#include <osl/diagnose.h>
+#include <osl/endian.h>
+#include <osl/file.h>
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <osl/thread.h>
+#include <osl/thread.hxx>
+#include <osl/time.h>
+#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/stringconcat.hxx>
+#include <rtl/stringutils.hxx>
+#include <rtl/tencinfo.h>
+#include <rtl/textenc.h>
+#include <rtl/unload.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.h>
+#include <rtl/ustring.hxx>
+#include <sal/config.h>
+#include <sal/log.hxx>
+#include <sal/macros.h>
+#include <sal/saldllapi.h>
+#include <sal/types.h>
+#include <sal/typesizes.h>
+#include <vcl/dllapi.h>
+#include <vcl/svapp.hxx>
+#endif // PCH_LEVEL >= 2
+#if PCH_LEVEL >= 3
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/numeric.hxx>
+#include <o3tl/safeint.hxx>
+#include <o3tl/sorted_vector.hxx>
+#include <sfx2/dllapi.h>
+#include <tools/color.hxx>
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+#include <xmloff/attrlist.hxx>
+#endif // PCH_LEVEL >= 3
+#if PCH_LEVEL >= 4
+#endif // PCH_LEVEL >= 4
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/ixfattrlist.hxx b/lotuswordpro/inc/xfilter/ixfattrlist.hxx
new file mode 100644
index 000000000..1fb79b60d
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/ixfattrlist.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Interface for the attribute list of a xml element.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_IXFATTRLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_IXFATTRLIST_HXX
+
+#include <rtl/ustring.hxx>
+
+/**
+ * @brief
+ * Attribute list interface for sax writer.
+ * Implement this interface for different sax writer. For OOo,i use the XDocumentHandler stream;
+ * for outputting the local file system,It's just a vector container.
+ */
+class IXFAttrList
+{
+public:
+ virtual ~IXFAttrList() {}
+ /**
+ * @descr: Add an attribute to the attribute list.
+ */
+ virtual void AddAttribute(const OUString& name, const OUString& value) = 0;
+
+ /**
+ * @descr: Clear all the attributes in the attribute list.
+ */
+ virtual void Clear() = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/ixfstream.hxx b/lotuswordpro/inc/xfilter/ixfstream.hxx
new file mode 100644
index 000000000..922e79952
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/ixfstream.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Sax stream to export xml to SODC.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_IXFSTREAM_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_IXFSTREAM_HXX
+
+#include <rtl/ustring.hxx>
+
+class IXFAttrList;
+
+/**
+ * @brief
+ * Stream wrapper for sax writer.
+ */
+class IXFStream
+{
+public:
+ virtual ~IXFStream(){}
+ /**
+ * @descr Called when start write.Usually you can output document type info and xml encoding info.
+ */
+ virtual void StartDocument() = 0;
+
+ /**
+ * @descr called when end output.
+ */
+ virtual void EndDocument() = 0;
+
+ /**
+ * @descr Wrap XDocumentHandler::startElement()
+ * @param oustr element tag name.
+ */
+ virtual void StartElement(const OUString& oustr) = 0;
+
+ /**
+ * @descr Wrap XDocumentHandler::endElement()
+ * @param oustr element tag name.
+ */
+ virtual void EndElement(const OUString& oustr) = 0;
+
+ /**
+ * @descr output text node.
+ * @param oustr text content.
+ */
+ virtual void Characters(const OUString& oustr) = 0;
+
+ /**
+ * @descr return the Attribute list interface.
+ * @return attribute list.
+ */
+ virtual IXFAttrList* GetAttrList() = 0;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/ixfstyle.hxx b/lotuswordpro/inc/xfilter/ixfstyle.hxx
new file mode 100644
index 000000000..878c8af65
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/ixfstyle.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Interface for all style object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_IXFSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_IXFSTYLE_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfdefs.hxx>
+
+/**
+ * @descr
+ * Interface for all style object.
+ */
+class IXFStyle
+{
+public:
+ IXFStyle() = default;
+ IXFStyle(IXFStyle const &) = default;
+ IXFStyle(IXFStyle &&) = default;
+ IXFStyle & operator =(IXFStyle const &) = default;
+ IXFStyle & operator =(IXFStyle &&) = default;
+
+ virtual ~IXFStyle(){}
+ /**
+ * @descr: return the style name.
+ */
+ virtual OUString GetStyleName() = 0;
+
+ /**
+ * @descr: set the name of the style.
+ */
+ virtual void SetStyleName(const OUString& styleName) = 0;
+
+ /**
+ * @descr return the parent style name.
+ */
+ virtual OUString GetParentStyleName() = 0;
+ /**
+ * @descr: Parent paragraph style.
+ */
+ virtual void SetParentStyleName(const OUString& parent) = 0;
+ /**
+ * @descr: return the style family. You can reference to enumXFStyle.
+ */
+ virtual enumXFStyle GetStyleFamily() = 0;
+
+ /**
+ * @descr: Compare whatever two style object are the same. Used only by XFStyleManager.
+ * @param: pStyle the style to be compared.
+ * @return: return sal_True if equals, else sal_False.
+ */
+ virtual bool Equal(IXFStyle *pStyle) = 0;
+
+ virtual void ToXml(IXFStream * stream) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfannotation.hxx b/lotuswordpro/inc/xfilter/xfannotation.hxx
new file mode 100644
index 000000000..5987ed665
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfannotation.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Annotation object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFANNOTATION_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFANNOTATION_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+
+class XFAnnotation : public XFContentContainer
+{
+public:
+ void SetDate(const OUString& date);
+
+ void SetAuthor(const OUString& author);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strDate;
+ OUString m_strAuthor;
+};
+
+inline void XFAnnotation::SetDate(const OUString& date)
+{
+ m_strDate = date;
+}
+
+inline void XFAnnotation::SetAuthor(const OUString& author)
+{
+ m_strAuthor = author;
+}
+
+inline void XFAnnotation::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( !m_strDate.isEmpty() )
+ pAttrList->AddAttribute( "office:create-date", m_strDate );
+ if( !m_strAuthor.isEmpty() )
+ pAttrList->AddAttribute( "office:author", m_strAuthor);
+ pStrm->StartElement( "office:annotation" );
+
+ XFContentContainer::ToXml(pStrm);
+
+ pStrm->EndElement( "office:annotation" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfarrowstyle.hxx b/lotuswordpro/inc/xfilter/xfarrowstyle.hxx
new file mode 100644
index 000000000..c356318f8
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfarrowstyle.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line Arrow.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFARROWSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFARROWSTYLE_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfstyle.hxx>
+
+class XFArrowStyle : public XFStyle
+{
+public:
+ XFArrowStyle();
+
+public:
+ void SetArrowName(const OUString& name);
+
+ void SetViewbox(const OUString& viewBox);
+
+ void SetSVGPath(const OUString& path);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strName;
+ OUString m_strViewBox;
+ OUString m_strPath;
+};
+
+inline XFArrowStyle::XFArrowStyle()
+{
+}
+
+inline void XFArrowStyle::SetArrowName(const OUString& name)
+{
+ m_strName = name;
+}
+
+inline void XFArrowStyle::SetViewbox(const OUString& viewBox)
+{
+ m_strViewBox = viewBox;
+}
+
+inline void XFArrowStyle::SetSVGPath(const OUString& path)
+{
+ m_strPath = path;
+}
+
+inline enumXFStyle XFArrowStyle::GetStyleFamily()
+{
+ return enumXFStyleArrow;
+}
+
+inline void XFArrowStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( !m_strName.isEmpty() )
+ pAttrList->AddAttribute( "draw:name", m_strName );
+ else
+ pAttrList->AddAttribute( "draw:name", GetStyleName() );
+
+ pAttrList->AddAttribute( "svg:viewBox", m_strViewBox );
+ pAttrList->AddAttribute( "svg:d", m_strPath );
+ pStrm->StartElement("draw:marker");
+ pStrm->EndElement("draw:marker");
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfbgimage.hxx b/lotuswordpro/inc/xfilter/xfbgimage.hxx
new file mode 100644
index 000000000..ea14229f4
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfbgimage.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Background image.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBGIMAGE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBGIMAGE_HXX
+
+#include <xfilter/xfstyle.hxx>
+
+/**
+ * @brief
+ * Background image object.
+ */
+class XFBGImage : public XFStyle
+{
+public:
+ XFBGImage();
+
+public:
+ /**
+ * @descr Use file link as image source.
+ */
+ void SetFileLink(const OUString& fileName);
+
+ /**
+ * @descr Use base64 stream as image source.
+ */
+ void SetImageData(sal_uInt8 const *buf, int len);
+
+ /**
+ * @descr Set the image position type.
+ */
+ void SetPosition(enumXFAlignType horiAlign = enumXFAlignCenter, enumXFAlignType vertAlign = enumXFAlignCenter);
+
+ /**
+ * @descr Set background image repeat style.
+ */
+ void SetRepeate();
+
+ /**
+ * @descr Set whether the image should be stretched to fill the owner object.
+ */
+ void SetStretch();
+
+ /**
+ * @descr decide whether there has been a style that is the same as this object.
+ * If it use base64 stream, i'll simply return sal_False because it's too slow to compare two base64 stream.
+ */
+ virtual bool Equal(IXFStyle *pStyle) override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ friend bool operator==(XFBGImage const & img1, XFBGImage const & img2);
+ friend bool operator!=(XFBGImage const & img1, XFBGImage const & img2);
+private:
+ OUString m_strFileName;
+ OUString m_strData;
+ bool m_bUserFileLink;
+ bool m_bRepeate;
+ bool m_bStretch;
+ bool m_bPosition;
+ enumXFAlignType m_eHoriAlign;
+ enumXFAlignType m_eVertAlign;
+};
+
+inline void XFBGImage::SetFileLink(const OUString& fileName)
+{
+ m_strFileName = fileName;
+ m_bUserFileLink = true;
+}
+
+inline void XFBGImage::SetPosition(enumXFAlignType horiAlign, enumXFAlignType vertAlign)
+{
+ m_bPosition = true;
+ m_eHoriAlign = horiAlign;
+ m_eVertAlign = vertAlign;
+
+ m_bStretch = false;
+ m_bRepeate = false;
+}
+
+inline void XFBGImage::SetRepeate()
+{
+ m_bRepeate = true;
+ m_bStretch = false;
+ m_bPosition = false;
+}
+
+inline void XFBGImage::SetStretch()
+{
+ m_bStretch = true;
+ m_bRepeate = false;
+ m_bPosition = false;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfbookmark.hxx b/lotuswordpro/inc/xfilter/xfbookmark.hxx
new file mode 100644
index 000000000..1dd473f94
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfbookmark.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Bookmark ref.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBOOKMARK_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBOOKMARK_HXX
+
+#include <sal/config.h>
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcontent.hxx>
+
+/**
+ * @brief
+ * Bookmark object.
+ */
+class XFBookmark : public XFContent
+{
+public:
+ explicit XFBookmark(bool isStart)
+ {
+ m_bStart = isStart;
+ }
+
+ const OUString& GetDivision() const {return m_strDivision;}
+ void SetDivision(const OUString& sDivName){m_strDivision = sDivName;}
+ const OUString& GetName() const {return m_strName;}
+
+public:
+ /**
+ * @descr Set bookmark name, which will be used in bookmark-ref or formula.
+ */
+ void SetName(const OUString& name)
+ {
+ m_strName = name;
+ }
+
+ virtual void ToXml(IXFStream *pStrm) override
+ {
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "text:name", m_strName );
+ if( m_bStart )
+ {
+ pStrm->StartElement( "text:bookmark-start" );
+ pStrm->EndElement( "text:bookmark-start" );
+ }
+ else
+ {
+ pStrm->StartElement( "text:bookmark-end" );
+ pStrm->EndElement( "text:bookmark-end" );
+ }
+ }
+
+private:
+ bool m_bStart;
+ OUString m_strName;
+ OUString m_strDivision;
+};
+
+class XFBookmarkStart : public XFBookmark
+{
+public:
+ XFBookmarkStart():XFBookmark(true){}
+};
+
+class XFBookmarkEnd : public XFBookmark
+{
+public:
+ XFBookmarkEnd():XFBookmark(false){}
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfborders.hxx b/lotuswordpro/inc/xfilter/xfborders.hxx
new file mode 100644
index 000000000..2f9eadf48
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfborders.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Border object,now only used by paragraph object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBORDERS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBORDERS_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfdefs.hxx>
+
+/**
+ * @brief
+ * Single border object for all objects with borders.
+ */
+class XFBorder
+{
+public:
+ XFBorder();
+
+public:
+ /**
+ * @descr Set border color.
+ */
+ void SetColor(XFColor const & color);
+
+ /**
+ * @descr Set border width in cm.
+ */
+ void SetWidth(double width);
+
+ /**
+ * @descr Set whether the border has double line.
+ */
+ void SetDoubleLine(bool dual,bool bSameWidth);
+
+ /**
+ * @descr Set inner line width for border with double line.
+ */
+ void SetWidthInner(double inner);
+
+ /**
+ * @descr Set space between double lines of border.
+ */
+ void SetWidthSpace(double space);
+
+ /**
+ * @descr Set outer line width for border with double line.
+ */
+ void SetWidthOuter(double outer);
+
+private:
+ /**
+ * @descr First line width to OOo border width format.
+ */
+ OUString GetLineWidth();
+
+ OUString ToString();
+
+ friend bool operator==(XFBorder const & b1, XFBorder const & b2);
+ friend bool operator!=(XFBorder const & b1, XFBorder const & b2);
+ friend class XFBorders;
+
+private:
+ XFColor m_aColor;
+ bool m_bDouble;
+ bool m_bSameWidth;
+ double m_fWidthInner;
+ double m_fWidthSpace;
+ double m_fWidthOuter;
+};
+
+/**
+ * @brief
+ * Borders for object with borders.
+ * Borders may include (right,left,top,bottom) borders.
+ */
+class XFBorders
+{
+public:
+ XFBorders(){}
+
+public:
+ /**
+ * @descr Set color of border side.
+ */
+ void SetColor(enumXFBorder side, XFColor const & color);
+
+ /**
+ * @descr Set width or border side.
+ */
+ void SetWidth(enumXFBorder side, double width);
+
+ /**
+ * @descr Set border side as double line.
+ */
+ void SetDoubleLine(enumXFBorder side);
+
+ /**
+ * @descr Set inner border with of border side.
+ */
+ void SetWidthInner(enumXFBorder side, double inner);
+
+ /**
+ * @descr Set space between two borders of border side.
+ */
+ void SetWidthSpace(enumXFBorder side, double space);
+
+ /**
+ * @descr Set outer border width of border side.
+ */
+ void SetWidthOuter(enumXFBorder side, double outer);
+
+ XFBorder& GetLeft() {return m_aBorderLeft;}
+
+ XFBorder& GetRight() {return m_aBorderRight;}
+
+ XFBorder& GetTop() {return m_aBorderTop;}
+
+ XFBorder& GetBottom() {return m_aBorderBottom;}
+
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFBorders const & b1, XFBorders const & b2);
+ friend bool operator!=(XFBorders const & b1, XFBorders const & b2);
+
+private:
+ XFBorder m_aBorderLeft;
+ XFBorder m_aBorderRight;
+ XFBorder m_aBorderTop;
+ XFBorder m_aBorderBottom;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfbreaks.hxx b/lotuswordpro/inc/xfilter/xfbreaks.hxx
new file mode 100644
index 000000000..fe2d7cee1
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfbreaks.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Breaks of paragraph.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBREAKS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFBREAKS_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfdefs.hxx>
+
+/**
+ * @descr Page|Column break object.
+ */
+class XFBreaks
+{
+public:
+ XFBreaks();
+
+ /**
+ * @descr Set break type, pls refer to enumXFBreaks.
+ */
+ void SetBreakType(enumXFBreaks breaks);
+
+ /**
+ * @descr Output breaks object.
+ */
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFBreaks const & b1, XFBreaks const & b2);
+ friend bool operator!=(XFBreaks const & b1, XFBreaks const & b2);
+
+private:
+ enumXFBreaks m_eBreaks;
+};
+
+inline XFBreaks::XFBreaks() : m_eBreaks(enumXFBreakAuto)
+{}
+
+inline void XFBreaks::SetBreakType(enumXFBreaks breaks)
+{
+ m_eBreaks = breaks;
+}
+
+inline void XFBreaks::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ switch(m_eBreaks)
+ {
+ case enumXFBreakAuto:
+ break;
+ case enumXFBreakBefPage:
+ pAttrList->AddAttribute( "fo:break-before", "page" );
+ break;
+ case enumXFBreakBefColumn:
+ pAttrList->AddAttribute( "fo:break-before", "column" );
+ break;
+ case enumXFBreakAftPage:
+ pAttrList->AddAttribute( "fo:break-after", "page" );
+ break;
+ case enumXFBreakAftColumn:
+ pAttrList->AddAttribute( "fo:break-after", "column" );
+ break;
+ case enumXFBreakKeepWithNext:
+ pAttrList->AddAttribute( "fo:keep-with-next", "true" );
+ break;
+ }
+}
+
+inline bool operator==(XFBreaks const & b1, XFBreaks const & b2)
+{
+ return b1.m_eBreaks == b2.m_eBreaks;
+}
+
+inline bool operator!=(XFBreaks const & b1, XFBreaks const & b2)
+{
+ return !(b1==b2);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcell.hxx b/lotuswordpro/inc/xfilter/xfcell.hxx
new file mode 100644
index 000000000..81ab8aa59
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcell.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table cell.
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCELL_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCELL_HXX
+
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+
+class XFTable;
+class XFRow;
+
+/**
+ * @descr Table cell object.
+ */
+class XFCell : public XFContentContainer
+{
+public:
+ XFCell();
+
+ virtual ~XFCell() override;
+
+public:
+ using XFContentContainer::Add;
+
+ /**
+ * @descr Add content for table cell.
+ */
+ void Add(XFContent *pContent) override;
+
+ /**
+ * @descr If cell spans more the one column, then set column span.
+ */
+ void SetColumnSpaned(sal_Int32 num);
+
+ /**
+ * @descr Set whether the following cells use the same style and content.
+ */
+ void SetRepeated(sal_Int32 num);
+
+ /**
+ * @descr Set cell number value.
+ */
+ void SetValue(double value);
+
+ /**
+ * @descr Set cell number value.
+ */
+ void SetValue(const OUString& value);
+
+ /**
+ * @descr Set cell formula.
+ */
+ void SetFormula(const OUString& formula);
+
+ /**
+ * @descr Set cell protected.
+ */
+ void SetProtect(bool protect);
+
+ /**
+ * @descr Set cell column id.
+ */
+ void SetCol(sal_Int32 col);
+
+ /**
+ * @descr Set cell owner row.
+ */
+ void SetOwnerRow(XFRow *pRow);
+
+ /**
+ * @descr Return cell name. It's a tool function for formula.
+ */
+ OUString GetCellName();
+
+ /**
+ * @descr return cell column span property.
+ */
+ sal_Int32 GetColSpaned() const;
+
+ /**
+ * @descr Output cell as xml element.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ const XFTable* GetSubTable() const { return m_pSubTable.get(); }
+
+private:
+ XFRow *m_pOwnerRow;
+ rtl::Reference<XFTable>
+ m_pSubTable;
+ sal_Int32 m_nCol;
+ sal_Int32 m_nColSpaned;
+ sal_Int32 m_nRepeated;
+ enumXFValueType m_eValueType;
+ OUString m_strValue;
+ OUString m_strFormula;
+ bool m_bProtect;
+};
+
+inline void XFCell::SetColumnSpaned(sal_Int32 num)
+{
+ m_nColSpaned = num;
+}
+
+inline void XFCell::SetRepeated(sal_Int32 repeated)
+{
+ m_nRepeated = repeated;
+}
+
+inline void XFCell::SetFormula(const OUString& formula)
+{
+ m_strFormula = formula;
+}
+
+inline void XFCell::SetProtect(bool protect/* =sal_True */)
+{
+ m_bProtect = protect;
+}
+
+inline void XFCell::SetCol(sal_Int32 col)
+{
+ m_nCol = col;
+}
+
+inline void XFCell::SetOwnerRow(XFRow *pRow)
+{
+ m_pOwnerRow = pRow;
+}
+
+inline sal_Int32 XFCell::GetColSpaned() const
+{
+ return m_nColSpaned;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcellstyle.hxx b/lotuswordpro/inc/xfilter/xfcellstyle.hxx
new file mode 100644
index 000000000..ff081b58a
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcellstyle.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table cell style. Number format, string value, and so on...
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCELLSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCELLSTYLE_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xfpadding.hxx>
+#include <xfilter/xfshadow.hxx>
+
+#include <memory>
+
+class XFBorders;
+class XFFont;
+class XFBorders;
+class XFMargins;
+class XFBGImage;
+
+/**
+ * @descr Style object for cell.
+ */
+class XFCellStyle : public XFStyle
+{
+public:
+ XFCellStyle();
+
+ virtual ~XFCellStyle() override;
+
+public:
+ /**
+ * @descr Set cell data format style name.
+ */
+ void SetDataStyle(const OUString& style);
+
+ /**
+ * @descr: Set the padding of the paragraph.This is the distance
+ between the border and the top of the text.
+ * @param: indent value of the padding.
+ */
+ void SetPadding(double left, double right, double top, double bottom);
+
+ /**
+ * @descr: Set alignment property of the cell.
+ * @param: eAlign alignment type,left,right,center or justify.
+ */
+ void SetAlignType(enumXFAlignType hori, enumXFAlignType vert);
+
+ /**
+ * @descr: The borders are complex, so you have to create one before use.
+ Very few paragraphs will already have borders property, this way
+ we can save much memory.
+ * @param: pBorders borders of the paragraph, please reference the XFBorders.
+ */
+ void SetBorders(XFBorders *pBorders);
+
+ /**
+ * @descr: Set background color of the cell.
+ * @param: color value of the back color.
+ */
+ void SetBackColor(XFColor const & color);
+
+ /**
+ * descr: set cell background image.
+ */
+ void SetBackImage(std::unique_ptr<XFBGImage>& rImage);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual bool Equal(IXFStyle *pStyle) override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strDataStyle;
+ enumXFAlignType m_eHoriAlign;
+ enumXFAlignType m_eVertAlign;
+
+ XFColor m_aBackColor;
+ std::unique_ptr<XFBGImage> m_xBackImage;
+ XFMargins m_aMargin;
+ XFPadding m_aPadding;
+ rtl::Reference<XFFont> m_pFont;
+ XFShadow m_aShadow;
+ std::unique_ptr<XFBorders> m_pBorders;
+};
+
+inline void XFCellStyle::SetAlignType(enumXFAlignType hori, enumXFAlignType vert)
+{
+ m_eHoriAlign = hori;
+ m_eVertAlign = vert;
+}
+
+inline void XFCellStyle::SetDataStyle(const OUString& style)
+{
+ m_strDataStyle = style;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfchange.hxx b/lotuswordpro/inc/xfilter/xfchange.hxx
new file mode 100644
index 000000000..29519e847
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfchange.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCHANGE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCHANGE_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <rtl/ustring.hxx>
+
+class XFChangeList : public XFContentContainer
+{
+public:
+ XFChangeList(){}
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFChangeRegion : public XFContentContainer
+{
+public:
+ XFChangeRegion(){}
+ virtual void ToXml(IXFStream *pStrm) override;
+ void SetChangeID(const OUString& sID){m_sID=sID;}
+ void SetEditor(const OUString& sEditor){m_sEditor=sEditor;}
+protected:
+ OUString m_sID;
+ OUString m_sEditor;
+};
+
+class XFChangeInsert : public XFChangeRegion
+{
+public:
+ XFChangeInsert(){}
+ void ToXml(IXFStream *pStrm) override;
+};
+
+class XFChangeDelete : public XFChangeRegion
+{
+public:
+ XFChangeDelete(){}
+ void ToXml(IXFStream *pStrm) override;
+};
+
+class XFChangeStart : public XFContent
+{
+public:
+ XFChangeStart(){}
+ void ToXml(IXFStream *pStrm) override;
+ void SetChangeID(const OUString& sID){m_sID=sID;}
+private:
+ OUString m_sID;
+};
+
+class XFChangeEnd : public XFContent
+{
+public:
+ XFChangeEnd(){}
+ void ToXml(IXFStream *pStrm) override;
+ void SetChangeID(const OUString& sID){m_sID=sID;}
+private:
+ OUString m_sID;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcolor.hxx b/lotuswordpro/inc/xfilter/xfcolor.hxx
new file mode 100644
index 000000000..ffb16c3bf
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcolor.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Color object to serial to xml filter.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCOLOR_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCOLOR_HXX
+
+#include <rtl/ustring.hxx>
+
+/**
+ * @brief
+ * Color object.
+ */
+class XFColor
+{
+public:
+ XFColor():m_nRed(sal_Int8(0)),m_nGreen(sal_Int8(0)),m_nBlue(sal_Int8(0))
+ {
+ m_bValid = false;
+ }
+ XFColor(sal_Int32 red, sal_Int32 green, sal_Int32 blue)
+ :m_nRed(static_cast<sal_Int8>(red)),m_nGreen(static_cast<sal_Int8>(green)),m_nBlue(static_cast<sal_Int8>(blue))
+ {
+ m_bValid = true;
+ }
+ explicit XFColor(sal_uInt32 color)
+ {
+ unsigned int c = color&0x00ffffff;
+ unsigned int temp = c;
+ m_nRed = static_cast<sal_uInt8>(temp&0x000000ff);
+
+ temp = c;
+ m_nGreen = static_cast<sal_uInt8>((temp&0x0000ff00)>>8);
+
+ temp = c;
+ m_nBlue = static_cast<sal_uInt8>((temp&0x00ff0000)>>16);
+
+ m_bValid = true;
+ }
+
+ /**
+ * @descr helper function to assert whether a color is valid.
+ */
+ bool IsValid() const{ return m_bValid;}
+
+ OUString ToString ()const;
+
+ friend bool operator==(XFColor const & c1, XFColor const & c2);
+ friend bool operator!=(XFColor const & c1, XFColor const & c2);
+private:
+ sal_uInt8 m_nRed;
+ sal_uInt8 m_nGreen;
+ sal_uInt8 m_nBlue;
+ bool m_bValid;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcolstyle.hxx b/lotuswordpro/inc/xfilter/xfcolstyle.hxx
new file mode 100644
index 000000000..774a2e636
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcolstyle.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Column style object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCOLSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCOLSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+
+/**
+ * @brief
+ * Column style, it has only one property-the column width.
+ */
+class XFColStyle : public XFStyle
+{
+public:
+ XFColStyle();
+
+ virtual ~XFColStyle() override;
+
+public:
+ /**
+ * @descr Set column width.
+ */
+ void SetWidth(double width);
+
+ /**
+ * @descr return column width.
+ */
+ double GetWidth() const;
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ /**
+ * @descr output column style as an xml node.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ double m_fWidth;
+};
+
+inline void XFColStyle::SetWidth(double width)
+{
+ m_fWidth = width;
+}
+
+inline double XFColStyle::GetWidth() const
+{
+ return m_fWidth;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcolumns.hxx b/lotuswordpro/inc/xfilter/xfcolumns.hxx
new file mode 100644
index 000000000..fe806c9fe
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcolumns.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Columns styles for section, or paragraph.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCOLUMNS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCOLUMNS_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfdefs.hxx>
+#include <vector>
+
+#define XFCOLUMNS_FLAG_SEPARATOR 0X00000001
+#define XFCOLUMNS_FLAG_GAP 0X00000010
+
+/**
+ * @descr Columns object for page or section.
+ */
+class XFColumn
+{
+public:
+ XFColumn()
+ : m_nRelWidth(0)
+ , m_fMarginLeft(0)
+ , m_fMarginRight(0)
+ {}
+
+public:
+ /**
+ * @descr Set column relative width.
+ */
+ void SetRelWidth(sal_Int32 width);
+
+ /**
+ * @descr Set column margin left and margin right.
+ */
+ void SetMargins(double left, double right);
+
+ /**
+ * @descr output column style as an xml node.
+ */
+ void ToXml(IXFStream *pStrm);
+
+ friend class XFColumns;
+
+private:
+ sal_Int32 m_nRelWidth;
+ double m_fMarginLeft;
+ double m_fMarginRight;
+};
+
+class XFColumnSep
+{
+public:
+ XFColumnSep()
+ : m_nRelHeight(100)
+ , m_fWidth(0)
+ , m_eVertAlign(enumXFAlignMiddle)
+ {}
+public:
+ void SetRelHeight(sal_Int32 height);
+ void SetWidth(double width);
+ void SetColor(XFColor const & color);
+ void SetVerticalAlign(enumXFAlignType align);
+
+ void ToXml(IXFStream *pStrm);
+
+ friend class XFColumns;
+private:
+ sal_Int32 m_nRelHeight;
+ double m_fWidth;
+ XFColor m_aColor;
+ enumXFAlignType m_eVertAlign;
+};
+
+class XFColumns
+{
+public:
+ XFColumns()
+ : m_nFlag(0)
+ , m_nCount(0)
+ , m_fGap(0.0)
+ { }
+public:
+ void SetSeparator(XFColumnSep const & aSeparator);
+ void SetGap(double fGap);
+ void SetCount(sal_uInt16 nCount);
+ void AddColumn(XFColumn const & column);
+
+ void ToXml(IXFStream *pStrm);
+private:
+ sal_Int32 m_nFlag;
+ sal_uInt16 m_nCount;
+ double m_fGap;
+ std::vector<XFColumn> m_aColumns;
+ XFColumnSep m_aSeparator;
+
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfconfigmanager.hxx b/lotuswordpro/inc/xfilter/xfconfigmanager.hxx
new file mode 100644
index 000000000..78b5b97ba
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfconfigmanager.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Manager for all config object,include line number config.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCONFIGMANAGER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCONFIGMANAGER_HXX
+
+#include <xfilter/xfstylecont.hxx>
+#include <xfilter/xflinenumberconfig.hxx>
+#include <xfilter/xffootnoteconfig.hxx>
+#include <xfilter/xfendnoteconfig.hxx>
+#include <memory>
+
+/**
+ * @brief
+ * Config information for OOo document, ie, line count config, endnote and footnote config.
+ * This object should only exist one instance.
+ * Don't make this object a singleton because it's managed by XFStyleManager.
+ */
+class XFConfigManager : public XFStyleContainer
+{
+public:
+ XFConfigManager();
+ virtual ~XFConfigManager() override;
+
+public:
+ /**
+ * @descr Set line number config.
+ */
+ void SetLineNumberConfig(XFLineNumberConfig *pLNConfig);
+
+ /**
+ * @descr Set footnote config.
+ */
+ void SetFootnoteConfig(XFFootnoteConfig *pFNConfig);
+
+ /**
+ * @descr Set endnote config.
+ */
+ void SetEndnoteConfig(XFEndnoteConfig *pFNConfig);
+
+ /**
+ * @descr Output config information.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ std::unique_ptr<XFLineNumberConfig> m_pLineNumberConfig;
+ std::unique_ptr<XFFootnoteConfig> m_pFootnoteConfig;
+ std::unique_ptr<XFEndnoteConfig> m_pEndnoteConfig;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcontent.hxx b/lotuswordpro/inc/xfilter/xfcontent.hxx
new file mode 100644
index 000000000..2f04906a5
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcontent.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Base class for the all content object,ie. text,paragraph,picture,and so on.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCONTENT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCONTENT_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <stdexcept>
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfdefs.hxx>
+
+class IXFStream;
+
+/**
+ * @descr
+ * Base class for all content object.
+ * There is only two properties:style name and content type in this class.
+ */
+class XFContent : public salhelper::SimpleReferenceObject
+{
+public:
+ /**
+ * @short: return the content type.
+ */
+ virtual enumXFContent GetContentType() { return enumXFContentUnknown; }
+
+ /**
+ * @short: All content except XFTextContent can have a style.
+ */
+ virtual void SetStyleName(const OUString& style) { m_strStyleName = style; }
+
+ /**
+ * @short: return the style name.
+ */
+ const OUString& GetStyleName() const { return m_strStyleName; }
+
+ void DoToXml(IXFStream* stream)
+ {
+ if (m_bDoingToXml)
+ throw std::runtime_error("recursion in content");
+ m_bDoingToXml = true;
+ ToXml(stream);
+ m_bDoingToXml = false;
+ }
+
+protected:
+ XFContent()
+ : m_bDoingToXml(false)
+ {
+ }
+
+ virtual void ToXml(IXFStream* stream) = 0;
+
+ virtual ~XFContent() override {}
+
+ OUString m_strStyleName;
+
+private:
+ bool m_bDoingToXml;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcontentcontainer.hxx b/lotuswordpro/inc/xfilter/xfcontentcontainer.hxx
new file mode 100644
index 000000000..f3a843f14
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcontentcontainer.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Container for content.It will destroy all children when destroy.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCONTENTCONTAINER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCONTENTCONTAINER_HXX
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <rtl/ref.hxx>
+
+#include <xfilter/xfcontent.hxx>
+
+/**
+ * @brief
+ * A container for content.
+ * The contents will be deleted when delete container.
+ */
+class XFContentContainer : public XFContent
+{
+public:
+ XFContentContainer();
+
+ /**
+ * @descr Destructure, all contents will be deleted too.
+ */
+ virtual ~XFContentContainer() override;
+
+public:
+ /**
+ * @descr Add content.
+ */
+ virtual void Add(XFContent *pContent);
+
+ rtl::Reference<XFContent> GetLastContent();
+ void RemoveLastContent();
+ /**
+ * @descr convenience function for add text content.
+ */
+ void Add(const OUString& text);
+
+ /**
+ * @descr return the number of contents in the container.
+ */
+ int GetCount() const;
+
+ /**
+ * @descr get content by index.
+ */
+ rtl::Reference<XFContent> GetContent(sal_uInt32 index) const;
+
+ /**
+ * @descr clear all contents in the container.
+ */
+ void Reset();
+
+ /**
+ * @descr helper function, find first content by type.
+ */
+ rtl::Reference<XFContent> FindFirstContent(enumXFContent type);
+
+ /**
+ * @descr return the content type.
+ */
+ virtual enumXFContent GetContentType() override;
+ /**
+ * @descr Output to OOo model or local file.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ std::vector< rtl::Reference<XFContent> > m_aContents;
+};
+
+inline rtl::Reference<XFContent> XFContentContainer::GetContent(sal_uInt32 index) const
+{
+ if (index > m_aContents.size()-1)
+ return nullptr;
+ return m_aContents[index];
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfcrossref.hxx b/lotuswordpro/inc/xfilter/xfcrossref.hxx
new file mode 100644
index 000000000..9126f712b
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfcrossref.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * cross reference object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCROSSREF_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFCROSSREF_HXX
+
+#include <xfilter/xfcontent.hxx>
+
+/**
+ * @brief
+ * Index entry object.
+ */
+class XFCrossRefStart : public XFContent
+{
+public:
+ XFCrossRefStart();
+ virtual ~XFCrossRefStart() override;
+ void SetRefType(sal_uInt8 nType);
+ void SetMarkName(const OUString& sName);
+ void ToXml(IXFStream *pStrm) override;
+private:
+ enum{
+ CROSSREF_INVALID = 0,
+ CROSSREF_TEXT = 1,
+ CROSSREF_PAGE = 2,
+ CROSSREF_PARANUMBER = 3
+ };
+ sal_uInt8 m_nType;
+ OUString m_strMarkName;
+};
+
+inline void XFCrossRefStart::SetRefType(sal_uInt8 nType)
+{
+ m_nType = nType;
+}
+
+inline void XFCrossRefStart::SetMarkName(const OUString& sName)
+{
+ m_strMarkName = sName;
+}
+
+class XFCrossRefEnd : public XFContent
+{
+public:
+ XFCrossRefEnd();
+ virtual ~XFCrossRefEnd() override;
+ void ToXml(IXFStream *pStrm) override;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdate.hxx b/lotuswordpro/inc/xfilter/xfdate.hxx
new file mode 100644
index 000000000..9fe3ab94c
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdate.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Date field with date style.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDATE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDATE_HXX
+
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/ixfstream.hxx>
+
+/**
+ * @descr Date object.
+ */
+class XFDate : public XFContent
+{
+public:
+ XFDate();
+
+ virtual ~XFDate() override;
+
+ virtual void ToXml(IXFStream* pStrm) override;
+
+private:
+ OUString m_strText;
+};
+
+class XFDateStart : public XFDate
+{
+public:
+ virtual void ToXml(IXFStream* pStrm) override;
+};
+
+class XFDateEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream* pStrm) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdatestyle.hxx b/lotuswordpro/inc/xfilter/xfdatestyle.hxx
new file mode 100644
index 000000000..a1df3a5c0
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdatestyle.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Date style. The date format for date field.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDATESTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDATESTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xftimestyle.hxx>
+#include <xfilter/xfstylecont.hxx>
+
+class XFDatePart : public XFTimePart
+{
+public:
+ XFDatePart();
+public:
+ void SetTexture(bool bTexture);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ bool m_bTexture;
+};
+
+class XFDateStyle : public XFStyle
+{
+public:
+ XFDateStyle();
+
+ virtual ~XFDateStyle() override;
+
+public:
+ void AddYear( bool bLongFmt = true );
+
+ void AddMonth( bool bLongFmt = true, bool bTexture = false );
+
+ void AddMonthDay( bool bLongFmt = true );
+
+ void AddWeekDay( bool bLongFmt = true );
+
+ void AddEra();
+
+ void AddHour( bool bLongFmt = true );
+
+ void AddMinute( bool bLongFmt = true );
+
+ void AddSecond( bool bLongFmt = true );
+
+ void AddAmPm();
+
+ void AddText( const OUString& part );
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ XFStyleContainer m_aParts;
+};
+
+inline void XFDatePart::SetTexture(bool bTexture)
+{
+ m_bTexture = bTexture;
+}
+
+inline void XFDateStyle::AddYear( bool bLongFmt )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateYear);
+ part->SetLongFmt(bLongFmt);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddMonth( bool bLongFmt, bool bTexture )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateMonth);
+ part->SetLongFmt(bLongFmt);
+ part->SetTexture(bTexture);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddMonthDay( bool bLongFmt )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateMonthDay);
+ part->SetLongFmt(bLongFmt);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddWeekDay( bool bLongFmt )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateWeekDay);
+ part->SetLongFmt(bLongFmt);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddEra()
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateEra);
+ part->SetLongFmt(false);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddText( const OUString& text )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateText);
+ part->SetText(text);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddHour( bool bLongFmt )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateHour);
+ part->SetLongFmt(bLongFmt);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddMinute( bool bLongFmt )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateMinute);
+ part->SetLongFmt(bLongFmt);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddSecond( bool bLongFmt )
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateSecond);
+ part->SetLongFmt(bLongFmt);
+ part->SetDecimalPos(0);
+ m_aParts.AddStyle(std::move(part));
+}
+
+inline void XFDateStyle::AddAmPm()
+{
+ std::unique_ptr<XFDatePart> part(new XFDatePart());
+ part->SetPartType(enumXFDateAmPm);
+ m_aParts.AddStyle(std::move(part));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdefs.hxx b/lotuswordpro/inc/xfilter/xfdefs.hxx
new file mode 100644
index 000000000..0b552236a
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdefs.hxx
@@ -0,0 +1,498 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * enum const defines.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDEFS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDEFS_HXX
+
+enum enumXFContent
+{
+ enumXFContentUnknown,
+ enumXFContentText,
+ enumXFContentSpan,
+ enumXFContentPara,
+ enumXFContentHeading,
+ enumXFContentTable,
+ enumXFContentTableCell,
+ enumXFContentTableRow,
+ enumXFContentTableCol,
+ enumXFContentGraphics,
+ enumXFContentFrame,
+ enumXFContentContainer,
+};
+
+enum enumXFStyle
+{
+ enumXFStyleUnknown,
+ enumXFStyleText,
+ enumXFStylePara,
+ enumXFStyleList,
+ enumXFStyleSection,
+ enumXFStyleGraphics,
+ enumXFStylePageMaster,
+ enumXFStyleMasterPage,
+ enumXFStyleDate,
+ enumXFStyleTime,
+ enumXFStylePercent,
+ enumXFStyleNumber,
+ enumXFStyleCurrency,
+ enumXFStyleTable,
+ enumXFStyleTableCell,
+ enumXFStyleTableRow,
+ enumXFStyleTableCol,
+ enumXFStyleOutline,
+ enumXFStyleStrokeDash,
+ enumXFStyleArea,
+ enumXFStyleArrow,
+ enumXFStyleRuby,
+ enumXFStyleDefaultPara,
+};
+
+enum enumXFFrameType
+{
+ enumXFFrameUnknown,
+ enumXFFrameDrawing,
+ enumXFFrameImage,
+ enumXFFrameTextbox,
+};
+
+enum enumXFUnderline
+{
+ enumXFUnderlineNone = 0,
+ enumXFUnderlineSingle,
+ enumXFUnderlineDouble,
+ enumXFUnderlineDotted,
+ enumXFUnderlineDash,
+ enumXFUnderlineLongDash,
+ enumXFUnderlineDotDash,
+ enumXFUnderlineDotDotDash,
+ enumXFUnderlineWave,
+ enumXFUnderlineBold,
+ enumXFUnderlineBoldDotted,
+ enumXFUnderlineBoldDash,
+ enumXFUnderlineBoldLongDash,
+ enumXFUnderlineBoldDotDash,
+ enumXFUnderlineBoldDotDotDash,
+ enumXFUnderlineBoldWave,
+ enumXFUnderlineDoubleWave,
+ enumXFUnderlineSmallWave
+};
+
+enum enumXFRelief
+{
+ enumXFReliefNone = 0,
+ enumXFReliefEngraved,
+ enumXFReliefEmbossed,
+};
+
+enum enumXFCrossout
+{
+ enumXFCrossoutNone = 0,
+ enumXFCrossoutSignel,
+ enumXFCrossoutDouble,
+ enumXFCrossoutThick,
+ enumXFCrossoutSlash,
+ enumXFCrossoutX
+};
+
+enum enumXFTransform
+{
+ enumXFTransformNone = 0,
+ enumXFTransformUpper,
+ enumXFTransformLower,
+ enumXFTransformCapitalize,
+ enumXFTransformSmallCaps
+};
+
+enum enumXFEmphasize
+{
+ enumXFEmphasizeNone = 0,
+ enumXFEmphasizeDot,
+ enumXFEmphasizeCircle,
+ enumXFEmphasizeDisc,
+ enumXFEmphasizeAccent
+};
+
+enum enumXFAlignType
+{
+ enumXFAlignNone = 0,
+ enumXFAlignStart,
+ enumXFAlignCenter,
+ enumXFAlignEnd,
+ enumXFAlignJustify,
+ enumXFAlignTop,
+ enumXFAlignMiddle,
+ enumXFAlignBottom,
+ enumXFALignMargins,
+};
+
+enum enumXFShadowPos
+{
+ enumXFShadowNone,
+ enumXFShadowRightBottom,
+ enumXFShadowRightTop,
+ enumXFShadowLeftBottom,
+ enumXFShadowLeftTop
+};
+
+enum enumXFBorder
+{
+ enumXFBorderNone,
+ enumXFBorderLeft,
+ enumXFBorderRight,
+ enumXFBorderTop,
+ enumXFBorderBottom,
+};
+
+/**************************************************************************
+ * @descr
+ * Line height type.
+ * enumLHHeight: height of the line, in "cm".
+ * enumLHLeast: the height may be adjusted, but has a min value.
+ * enumLHPercent: the height is a certain times of the normal height.
+ * enumLHSpace: space between lines.
+ *************************************************************************/
+enum enumLHType
+{
+ enumLHNone,
+ enumLHHeight,
+ enumLHLeast,
+ enumLHPercent,
+ enumLHSpace,
+};
+
+enum enumXFBreaks
+{
+ enumXFBreakAuto,
+ enumXFBreakBefPage,
+ enumXFBreakBefColumn,
+ enumXFBreakAftPage,
+ enumXFBreakAftColumn,
+ enumXFBreakKeepWithNext,
+};
+
+enum enumXFTab
+{
+ enumXFTabNone,
+ enumXFTabLeft,
+ enumXFTabCenter,
+ enumXFTabRight,
+ enumXFTabChar,
+};
+
+enum enumXFDatePart
+{
+ enumXFDateUnknown,
+ enumXFDateYear,
+ enumXFDateMonth,
+ enumXFDateMonthDay,
+ enumXFDateWeekDay,
+ enumXFDateYearWeek,
+ enumXFDateEra,
+ enumXFDateQuarter,
+ enumXFDateHour,
+ enumXFDateMinute,
+ enumXFDateSecond,
+ enumXFDateAmPm,
+ enumXFDateText
+};
+
+enum enumXFAnchor
+{
+ enumXFAnchorNone,
+ enumXFAnchorPara,
+ enumXFAnchorPage,
+ enumXFAnchorChar,
+ enumXFAnchorAsChar,
+ enumXFAnchorFrame
+};
+
+enum enumXFWrap
+{
+ enumXFWrapNone,
+ enumXFWrapLeft,
+ enumXFWrapRight,
+ enumXFWrapParallel,
+ enumXFWrapRunThrough,
+ enumXFWrapBest,
+ enumXFWrapBackground
+};
+
+enum enumXFTextDir
+{
+ enumXFTextDirNone,
+ enumXFTextDirLR,
+ enumXFTextDirLR_TB,
+ enumXFTextDirPage,
+ enumXFTextDirRL,
+ enumXFTextDirRL_TB,
+ enumXFTextDirTB,
+ enumXFTextDirTB_LR,
+ enumXFTextDirTB_RL
+};
+
+enum enumXFFrameXRel
+{
+ enumXFFrameXRelPage,
+ enumXFFrameXRelPageContent,
+ enumXFFrameXRelPageEndMargin,
+ enumXFFrameXRelPageStartMargin,
+ enumXFFrameXRelPara,
+ enumXFFrameXRelParaContent,
+ enumXFFrameXRelParaEndMargin,
+ enumXFFrameXRelParaStartMargin,
+ enumXFFrameXRelChar,
+ enumXFFrameXRelFrame,
+ enumXFFrameXRelFrameContent,
+ enumXFFrameXRelFrameEndMargin,
+ enumXFFrameXRelFrameStartMargin
+};
+
+enum enumXFFrameXPos
+{
+ enumXFFrameXPosLeft,
+ enumXFFrameXPosRight,
+ enumXFFrameXPosCenter,
+ enumXFFrameXPosFromLeft
+};
+
+enum enumXFFrameYRel
+{
+ enumXFFrameYRelBaseLine,
+ enumXFFrameYRelChar,
+ enumXFFrameYRelFrame,
+ enumXFFrameYRelFrameContent,
+ enumXFFrameYRelLine,
+ enumXFFrameYRelPage,
+ enumXFFrameYRelPageContent,
+ enumXFFrameYRelPara,
+ enumXFFrameYRelParaContent,
+ enumXFFrameYRelText
+};
+
+enum enumXFFrameYPos
+{
+ enumXFFrameYPosTop,
+ enumXFFrameYPosMiddle,
+ enumXFFrameYPosBottom,
+ enumXFFrameYPosFromTop,
+ enumXFFrameYPosBelow,
+};
+
+enum enumXFTableColVisible
+{
+ enumXFTableColVisibleYes,
+ enumXFTableColVisibleCollapse,
+ enumXFTableColVisibleFilter,
+};
+
+enum enumXFBookmarkRef
+{
+ enumXFBookmarkNone,
+ enumXFBookmarkPage,
+ enumXFBookmarkChapter,
+ enumXFBookmarkDir,
+ enumXFBookmarkDef
+};
+
+enum enumXFDrawKind
+{
+ enumXFDrawKindFull,
+ enumXFDrawKindSection,
+ enumXFDrawKindCut,
+ enumXFDrawKindArc
+};
+
+enum enumXFLineStyle
+{
+ enumXFLineNone,
+ enumXFLineSolid,
+ enumXFLineDot,
+ enumXFLineDash,
+ enumXFLineDotDash,
+ enumXFLineDashDot
+};
+
+enum enumXFAreaStyle
+{
+ enumXFAreaNone,
+ enumXFAreaSolid,
+ enumXFAreaGradient,
+ enumXFAreaBitmap,
+ enumXFAreaHatch
+};
+
+enum enumXFAreaLineStyle
+{
+ enumXFAreaLineSingle,
+ enumXFAreaLineCrossed,
+ enumXFAreaLineTriple
+};
+
+enum enumXFColorMode
+{
+ enumXFColorStandard,
+ enumXFColorGreyscale,
+ enumXFColorMono,
+ enumXFColorWatermark
+};
+
+enum enumXFPageUsage
+{
+ enumXFPageUsageNone,
+ enumXFPageUsageAll,
+ enumXFPageUsageLeft,
+ enumXFPageUsageRight,
+ enumXFPageUsageMirror
+};
+
+enum enumXFValueType
+{
+ enumXFValueTypeNone,
+ enumXFValueTypeBoolean,
+ enumXFValueTypeCurrency,
+ enumXFValueTypeDate,
+ enumXFValueTypeFloat,
+ enumXFValueTypePercentage,
+ enumXFValueTypeString,
+ enumXFValueTypeTime,
+};
+
+enum enumXFNumberType
+{
+ enumXFNumberNumber,
+ enumXFNumberPercent,
+ enuMXFNumberCurrency,
+ enumXFNumberScientific,
+ enumXFText,
+};
+
+enum enumXFLineNumberPos
+{
+ enumXFLineNumberLeft,
+ enumXFLineNumberRight,
+ enumXFLineNumberInner,
+ enumXFLineNumberOuter,
+};
+
+enum enumXFEntry
+{
+ enumXFEntryTOC,
+ enumXFEntryAlphabetical,
+ enumXFEntryUserIndex,
+};
+
+enum enumXFIndex
+{
+ enumXFIndexTOC,
+ enumXFIndexAlphabetical,
+ enumXFIndexUserIndex,
+ enumXFIndexObject,
+ enumXFIndexIllustration,
+ enumXFIndexTableIndex,
+};
+
+enum enumXFIndexTemplate
+{
+ enumXFIndexTemplateUnknown,
+ enumXFIndexTemplateChapter,
+ enumXFIndexTemplateText,
+ enumXFIndexTemplateTab,
+ enumXFIndexTemplatePage,
+ enumXFIndexTemplateLinkStart,
+ enumXFIndexTemplateLinkEnd,
+ enumXFIndexTemplateSpan,
+ enumXFIndexTemplateBibliography,
+};
+
+enum enumXFRubyPosition
+{
+ enumXFRubyLeft = 4,
+ enumXFRubyRight = 5,
+ enumXFRubyCenter = 2,
+ enumXFRubyTop = 1,
+ enumXFRubyBottom = 3,
+};
+enum enumXFFWStyle
+{
+ enumXFFWOff,
+ enumXFFWRotate,
+ enumXFFWUpright,
+ enumXFFWSlantX, //slant-x
+ enumXFFWSlantY //slant-y
+};
+
+enum enumXFFWAdjust
+{
+ enumXFFWAdjustAutosize, //autosize
+ enumXFFWAdjustLeft,
+ enumXFFWAdjustCenter, //center
+ enumXFFWAdustRight //right
+};
+
+enum enumXFFWShadow
+{
+ enumXFFWShadowNone,
+ enumXFFWShadowNormal,
+ enumXFFWShadowVertical,
+ enumXFFWShadowSlant
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdocfield.hxx b/lotuswordpro/inc/xfilter/xfdocfield.hxx
new file mode 100644
index 000000000..6582a33dd
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdocfield.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * doc field.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDOCFIELD_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDOCFIELD_HXX
+
+#include <xfilter/xfcontent.hxx>
+
+class XFFileName : public XFContent
+{
+public:
+ void SetType(const OUString& sType);
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+ OUString m_strType;
+};
+class XFWordCount : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFWordCountStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFWordCountEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFPageCountStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFPageCountEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFCharCount : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFCharCountStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFCharCountEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFDescription : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFDescriptionStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFDescriptionEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFKeywords : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFTotalEditTime : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFTotalEditTimeEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFTotalEditTimeStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFCreateTime : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFCreateTimeStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFCreateTimeEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFLastEditTime : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFLastEditTimeStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFLastEditTimeEnd : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFInitialCreator : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawgroup.hxx b/lotuswordpro/inc/xfilter/xfdrawgroup.hxx
new file mode 100644
index 000000000..746b8dca2
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawgroup.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Group of drawing objects.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWGROUP_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWGROUP_HXX
+
+#include <xfilter/xfdrawobj.hxx>
+#include <xfilter/xfframe.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+/**
+ * @brief
+ * Group object for drawing.
+ */
+class XFDrawGroup : public XFDrawObject
+{
+public:
+ XFDrawGroup(){}
+
+public:
+ using XFDrawObject::Add;
+
+ /**
+ * @descr Add a drawing object to the group.
+ */
+ void Add(XFFrame *pFrame);
+
+ /**
+ * @descr Output group object and all its children.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ rtl::Reference<XFContentContainer> m_aChildren;
+};
+
+inline void XFDrawGroup::Add(XFFrame *pFrame)
+{
+ if( pFrame )
+ m_aChildren->Add(pFrame);
+}
+
+inline void XFDrawGroup::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ XFDrawObject::ToXml(pStrm);
+
+ pStrm->StartElement( "draw:g" );
+
+ m_aChildren->ToXml(pStrm);
+
+ pStrm->EndElement( "draw:g" );
+
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawline.hxx b/lotuswordpro/inc/xfilter/xfdrawline.hxx
new file mode 100644
index 000000000..5d6309b25
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawline.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWLINE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWLINE_HXX
+
+#include <xfilter/xfdrawobj.hxx>
+#include <xfilter/xfpoint.hxx>
+
+/**
+ * @brief
+ * Line object of drawing layer.
+ */
+class XFDrawLine : public XFDrawObject
+{
+public:
+ XFDrawLine();
+
+public:
+ /**
+ * @descr Set line start point.
+ */
+ void SetStartPoint(double x, double y);
+
+ /**
+ * @descr Set line end point.
+ */
+ void SetEndPoint(double x, double y);
+
+ /**
+ * @descr Output line object.
+ */
+ virtual void ToXml(IXFStream* pStrm) override;
+
+private:
+ XFPoint m_aPoint1;
+ XFPoint m_aPoint2;
+};
+
+inline void XFDrawLine::SetStartPoint(double x, double y)
+{
+ m_aPoint1.SetX(x);
+ m_aPoint1.SetY(y);
+}
+
+inline void XFDrawLine::SetEndPoint(double x, double y)
+{
+ m_aPoint2.SetX(x);
+ m_aPoint2.SetY(y);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawlinestyle.hxx b/lotuswordpro/inc/xfilter/xfdrawlinestyle.hxx
new file mode 100644
index 000000000..5dae0ccd4
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawlinestyle.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line style of Drawing object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWLINESTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWLINESTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+
+/**
+ * @brief
+ * Border line style for drawing object.
+ */
+class XFDrawLineStyle : public XFStyle
+{
+public:
+ XFDrawLineStyle();
+
+public:
+ /**
+ * @descr Set line width.
+ */
+ void SetWidth(double width);
+
+ /**
+ * @descr Set line color.
+ */
+ void SetColor(const XFColor& color);
+
+ /**
+ * @descr Set line transparency.
+ */
+ void SetTransparency(sal_Int32 transparency);
+
+ /**
+ * @descr Set line type, solid,dash,dot?
+ */
+ void SetLineStyle(enumXFLineStyle style);
+
+ /**
+ * @descr Set first dot number of dash line.
+ */
+ void SetDot1Number(sal_Int32 number);
+
+ /**
+ * @descr Set second dot number of dash line.
+ */
+ void SetDot2Number(sal_Int32 number);
+
+ /**
+ * @descr Set first dot length.
+ */
+ void SetDot1Length(double length);
+
+ /**
+ * @descr Set second dot length.
+ */
+ void SetDot2Length(double length);
+
+ /**
+ * @descr Set space between dash dot.
+ */
+ void SetSpace(double space);
+
+ /**
+ * @descr decide whether it's a solid line.
+ */
+ bool IsSolid() const;
+
+ double GetWidth() const;
+
+ const XFColor& GetColor() const;
+
+ sal_Int32 GetTransparency() const;
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ enumXFLineStyle m_eLineStyle;
+ XFColor m_aColor;
+ double m_fWidth;
+ sal_Int32 m_nTransparency;
+ sal_Int32 m_nNumber1;
+ sal_Int32 m_nNumber2;
+ double m_fSpace;
+ double m_fLength1;
+ double m_fLength2;
+};
+
+inline void XFDrawLineStyle::SetWidth(double width)
+{
+ m_fWidth = width;
+}
+
+inline void XFDrawLineStyle::SetColor(const XFColor& color)
+{
+ m_aColor = color;
+}
+
+inline void XFDrawLineStyle::SetTransparency(sal_Int32 transparency)
+{
+ m_nTransparency = transparency;
+}
+
+inline void XFDrawLineStyle::SetLineStyle(enumXFLineStyle style)
+{
+ m_eLineStyle = style;
+}
+
+inline void XFDrawLineStyle::SetDot1Number(sal_Int32 number)
+{
+ m_nNumber1 = number;
+}
+
+inline void XFDrawLineStyle::SetDot2Number(sal_Int32 number)
+{
+ m_nNumber2 = number;
+}
+
+inline void XFDrawLineStyle::SetDot1Length(double length)
+{
+ m_fLength1 = length;
+}
+
+inline void XFDrawLineStyle::SetDot2Length(double length)
+{
+ m_fLength2 = length;
+}
+
+inline void XFDrawLineStyle::SetSpace(double space)
+{
+ m_fSpace = space;
+}
+
+inline bool XFDrawLineStyle::IsSolid() const
+{
+ return (m_eLineStyle==enumXFLineSolid);
+}
+
+inline double XFDrawLineStyle::GetWidth() const
+{
+ return m_fWidth;
+}
+
+inline const XFColor& XFDrawLineStyle::GetColor() const
+{
+ return m_aColor;
+}
+
+inline sal_Int32 XFDrawLineStyle::GetTransparency() const
+{
+ return m_nTransparency;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawobj.hxx b/lotuswordpro/inc/xfilter/xfdrawobj.hxx
new file mode 100644
index 000000000..c18058ade
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawobj.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Interface for all Drawing object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWOBJ_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWOBJ_HXX
+
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfframe.hxx>
+
+#define XFDRAWOBJECT_FLAG_ROTATE 0X00000001
+#define XFDRAWOBJECT_FLAG_TRANSLATE 0X00000002
+#define XFDRAWOBJECT_FLAG_SKEWX 0X00000004
+#define XFDRAWOBJECT_FLAG_SKEWY 0X00000008
+#define XFDRAWOBJECT_FLAG_SCALE 0X00000010
+
+/**
+ * @brief
+ * Base class for all drawing object(ellipse,rect,circle,...).
+ * I can set Positions,anchor,rotate,text style name here.
+ *
+ * Drawing objects can be rotated, scaled and skewed, drawing objects must have positions set,
+ * you can use SetPosition(...).
+ */
+class XFDrawObject : public XFFrame
+{
+public:
+ XFDrawObject();
+
+public:
+ /**
+ * @descr Set drawing object rotate.
+ */
+ void SetRotate(double degree)
+ {
+ m_nDrawFlag |= XFDRAWOBJECT_FLAG_ROTATE;
+ m_fRotate = degree*2*PI/360;
+ m_aRotatePoint = XFPoint(0,0);
+ }
+
+ void ContentToXml(IXFStream *pStrm);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+protected:
+ double m_fRotate;
+ XFPoint m_aRotatePoint;
+ unsigned int m_nDrawFlag;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawpath.hxx b/lotuswordpro/inc/xfilter/xfdrawpath.hxx
new file mode 100644
index 000000000..c18c07eb1
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawpath.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Draw path object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWPATH_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWPATH_HXX
+
+#include <xfilter/xfdrawobj.hxx>
+#include <vector>
+
+/**
+ * @brief
+ * SVG path segment wrapper.
+ */
+class XFSvgPathEntry
+{
+public:
+ XFSvgPathEntry();
+
+public:
+ /**
+ * @descr Set svg path command,L for line,M for move,...
+ */
+ void SetCommand(const OUString& cmd);
+
+ /**
+ * @descr Set svg path point.
+ */
+ void AddPoint(const XFPoint& pt)
+ {
+ m_aPoints.push_back(pt);
+ }
+
+ OUString ToString();
+
+ friend class XFDrawPath;
+private:
+ OUString m_strCommand;
+ std::vector<XFPoint> m_aPoints;
+};
+
+/**
+ * @brief
+ * For svg path wrapper.
+ */
+class XFDrawPath : public XFDrawObject
+{
+public:
+ XFDrawPath();
+
+public:
+ /**
+ * @descr Move command.
+ */
+ void MoveTo(XFPoint pt);
+
+ /**
+ * @descr Line command.
+ */
+ void LineTo(XFPoint pt);
+
+ /**
+ * @descr Curve command.
+ */
+ void CurveTo(XFPoint dest, XFPoint ctrl1, XFPoint ctrl2);
+
+ /**
+ * @descr Close path command.
+ */
+ void ClosePath();
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ std::vector<XFSvgPathEntry> m_aPaths;
+};
+
+inline void XFSvgPathEntry::SetCommand(const OUString& cmd)
+{
+ m_strCommand = cmd;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawpolygon.hxx b/lotuswordpro/inc/xfilter/xfdrawpolygon.hxx
new file mode 100644
index 000000000..8a04c1d61
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawpolygon.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Polygon object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWPOLYGON_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWPOLYGON_HXX
+
+#include <xfilter/xfdrawpolyline.hxx>
+
+/**
+ * @brief
+ * Polygon object.
+ */
+class XFDrawPolygon : public XFDrawPolyline
+{
+public:
+ XFDrawPolygon();
+
+public:
+ virtual void ToXml(IXFStream* pStrm) override;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawpolyline.hxx b/lotuswordpro/inc/xfilter/xfdrawpolyline.hxx
new file mode 100644
index 000000000..4e7ff34c7
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawpolyline.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Polyline.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWPOLYLINE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWPOLYLINE_HXX
+
+#include <xfilter/xfdrawobj.hxx>
+#include <vector>
+
+class XFDrawPolyline : public XFDrawObject
+{
+public:
+ XFDrawPolyline();
+
+public:
+ void AddPoint(double x, double y)
+ {
+ assert(x>=0&&y>=0);
+ m_aPoints.push_back( XFPoint(x,y) );
+ }
+
+ XFRect CalcViewBox();
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+protected:
+ std::vector<XFPoint> m_aPoints;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawrect.hxx b/lotuswordpro/inc/xfilter/xfdrawrect.hxx
new file mode 100644
index 000000000..e6036a9fa
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawrect.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Rect object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWRECT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWRECT_HXX
+
+#include <xfilter/xfdrawobj.hxx>
+
+class XFDrawRect : public XFDrawObject
+{
+public:
+ XFDrawRect();
+
+public:
+ void SetStartPoint(const XFPoint& pt)
+ {
+ m_aRect.SetStartPoint(pt);
+ }
+
+ void SetSize(double width, double height);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+inline void XFDrawRect::SetSize(double width, double height)
+{
+ m_aRect.SetSize(width,height);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdrawstyle.hxx b/lotuswordpro/inc/xfilter/xfdrawstyle.hxx
new file mode 100644
index 000000000..c6747729d
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdrawstyle.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style for all draw object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDRAWSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <cassert>
+#include <memory>
+
+class XFDrawLineStyle;
+class XFDrawAreaStyle;
+class XFFontWorkStyle;
+
+/**
+ * @brief
+ * Style for all drawing object, which can includes line style, area style, wrap style.
+ * Line style includes line type, line width and line color.
+ * Area style can be divided into 5 kinds, color fill, hatch, bitmap, gradient.I only support
+ * color fill and hatch now.
+ */
+class XFDrawStyle : public XFStyle
+{
+public:
+ XFDrawStyle();
+
+ virtual ~XFDrawStyle() override;
+
+public:
+ /**
+ * @descr Set drawing object border line.
+ */
+ void SetLineStyle(double width, XFColor color);
+
+ /**
+ * @descr Set drawing object dash border style.
+ */
+ void SetLineDashStyle(enumXFLineStyle style, double len1, double len2, double space );
+
+ /**
+ * @descr Set drawing object area fill color.
+ */
+ void SetAreaColor(XFColor const & color);
+
+ /**
+ * @descr Set drawing object area grid style.
+ */
+ void SetAreaLineStyle(enumXFAreaLineStyle style, sal_Int32 angle, double space, XFColor lineColor);
+
+ /**
+ * @descr Set drawing object arrow start style,only lines can have arrows.
+ */
+ void SetArrowStart(const OUString& start, double size);
+
+ /**
+ * @descr Set drawing object arrow end style,only lines can have arrows.
+ */
+ void SetArrowEnd(const OUString& end, double size);
+
+ void SetFontWorkStyle(enumXFFWStyle eStyle, enumXFFWAdjust eAdjust);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ std::unique_ptr<XFFontWorkStyle> m_pFontWorkStyle;
+ XFDrawLineStyle *m_pLineStyle;
+ XFDrawAreaStyle *m_pAreaStyle;
+ OUString m_strArrowStart;
+ OUString m_strArrowEnd;
+ double m_fArrowStartSize;
+ double m_fArrowEndSize;
+ bool m_bArrowStartCenter;
+ bool m_bArrowEndCenter;
+};
+
+inline void XFDrawStyle::SetArrowStart(const OUString& start, double size)
+{
+ assert(size>0);
+ m_strArrowStart = start;
+ m_fArrowStartSize = size;
+ m_bArrowStartCenter = true;
+}
+
+inline void XFDrawStyle::SetArrowEnd(const OUString& end, double size)
+{
+ assert(size>0);
+ m_strArrowEnd = end;
+ m_fArrowEndSize = size;
+ m_bArrowEndCenter = true;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfdropcap.hxx b/lotuswordpro/inc/xfilter/xfdropcap.hxx
new file mode 100644
index 000000000..eb5fb992e
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfdropcap.hxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Drop cap of a paragraph.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDROPCAP_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDROPCAP_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+class XFDropcap
+{
+public:
+ XFDropcap()
+ {
+ Reset();
+ }
+
+public:
+ void SetCharCount(sal_Int32 count);
+
+ void SetLines(sal_Int32 lines);
+
+ void SetDistance(double distance);
+
+ void Reset();
+
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFDropcap const & dc1, XFDropcap const & dc2);
+ friend bool operator!=(XFDropcap const & dc1, XFDropcap const & dc2);
+ friend class XFParaStyle;
+private:
+ sal_Int32 m_nCharCount;
+ sal_Int32 m_nLines;
+ double m_fDistance;
+ OUString m_strStyleName;
+};
+
+inline void XFDropcap::SetCharCount(sal_Int32 count)
+{
+ m_nCharCount = count;
+}
+
+inline void XFDropcap::SetLines(sal_Int32 lines)
+{
+ m_nLines = lines;
+}
+
+inline void XFDropcap::SetDistance(double distance)
+{
+ m_fDistance = distance;
+}
+
+inline void XFDropcap::Reset()
+{
+ m_nCharCount = 0;
+ m_nLines = 0;
+ m_fDistance = 0;
+ m_strStyleName.clear();
+}
+
+inline void XFDropcap::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( m_nCharCount < 1 || m_nLines < 2 )
+ return;
+ pAttrList->AddAttribute("style:length", OUString::number(m_nCharCount) );
+ pAttrList->AddAttribute("style:lines", OUString::number(m_nLines) );
+ pAttrList->AddAttribute("style:distance", OUString::number(m_fDistance) + "cm" );
+ if( !m_strStyleName.isEmpty() )
+ pAttrList->AddAttribute("style:style-name", m_strStyleName );
+ pStrm->StartElement( "style:drop-cap" );
+ pStrm->EndElement( "style:drop-cap" );
+}
+
+inline bool operator==(XFDropcap const & dc1, XFDropcap const & dc2)
+{
+ return (
+ (dc1.m_nCharCount == dc2.m_nCharCount)&&
+ (dc1.m_nLines == dc2.m_nLines)&&
+ (dc1.m_fDistance == dc2.m_fDistance)&&
+ (dc1.m_strStyleName == dc2.m_strStyleName)
+ );
+}
+
+inline bool operator!=(XFDropcap const & dc1, XFDropcap const & dc2)
+{
+ return !(dc1==dc2);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfendnote.hxx b/lotuswordpro/inc/xfilter/xfendnote.hxx
new file mode 100644
index 000000000..98bb28090
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfendnote.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * End note object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFENDNOTE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFENDNOTE_HXX
+
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+/**
+ * @brief
+ * End note object.
+ */
+class XFEndNote : public XFContentContainer
+{
+public:
+ XFEndNote();
+
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strID;
+ OUString m_strLabel;
+};
+
+inline XFEndNote::XFEndNote()
+{
+ m_strID = XFGlobal::GenNoteName();
+}
+
+
+inline void XFEndNote::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "text:id", m_strID );
+ pStrm->StartElement( "text:endnote" );
+
+ pAttrList->Clear();
+ if( !m_strLabel.isEmpty() )
+ pAttrList->AddAttribute( "text:label", m_strLabel );
+ pStrm->StartElement( "text:endnote-citation" );
+ if( !m_strLabel.isEmpty())
+ pStrm->Characters(m_strLabel);
+ pStrm->EndElement( "text:endnote-citation" );
+
+ pAttrList->Clear();
+ pStrm->StartElement( "text:endnote-body" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "text:endnote-body" );
+
+ pStrm->EndElement( "text:endnote" );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfendnoteconfig.hxx b/lotuswordpro/inc/xfilter/xfendnoteconfig.hxx
new file mode 100644
index 000000000..886a44e9f
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfendnoteconfig.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Endnote config.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFENDNOTECONFIG_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFENDNOTECONFIG_HXX
+
+#include <xfilter/xffootnoteconfig.hxx>
+
+class XFEndnoteConfig : public XFFootnoteConfig
+{
+public:
+ XFEndnoteConfig()
+ : XFFootnoteConfig()
+ {
+ m_bIsFootnote = false;
+ m_bInsertInPage = false;
+ m_strDefaultStyle = "Endnote";
+ m_strMasterPage = "Endnote";
+ m_strCitationStyle = "Endnote Symbol";
+ m_strBodyStyle = "Endnote anchor";
+ }
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfentry.hxx b/lotuswordpro/inc/xfilter/xfentry.hxx
new file mode 100644
index 000000000..6f7f97430
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfentry.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * index entry object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFENTRY_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFENTRY_HXX
+
+#include <xfilter/xfcontent.hxx>
+
+/**
+ * @brief
+ * Index entry object.
+ */
+class XFEntry : public XFContent
+{
+public:
+ XFEntry();
+
+public:
+ /**
+ * @descr Set entry type.
+ */
+ void SetEntryType(enumXFEntry type);
+
+ /**
+ * @descr Set entry string value.
+ */
+ void SetStringValue(const OUString& value);
+
+ /**
+ * @descr Set entry key. The keys is available only for enumXFEntryAlphabetical.
+ */
+ void SetKey(const OUString& key1, const OUString& key2);
+
+ /**
+ * @descr Set outline level. This is available for enumXFEntryTOC and enumXFEntryUserIndex.
+ */
+ void SetOutlineLevel(sal_Int32 level);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ enumXFEntry m_eType;
+ OUString m_strValue;
+ OUString m_strKey1;
+ OUString m_strKey2;
+ OUString m_strName;
+ sal_Int32 m_nOutlineLevel;
+};
+
+inline void XFEntry::SetEntryType(enumXFEntry type)
+{
+ m_eType = type;
+}
+
+inline void XFEntry::SetStringValue(const OUString& value)
+{
+ m_strValue = value;
+}
+
+inline void XFEntry::SetKey(const OUString& key1, const OUString& key2)
+{
+ m_strKey1 = key1;
+ m_strKey2 = key2;
+}
+
+inline void XFEntry::SetOutlineLevel(sal_Int32 level)
+{
+ m_nOutlineLevel = level;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffloatframe.hxx b/lotuswordpro/inc/xfilter/xffloatframe.hxx
new file mode 100644
index 000000000..e6b973d01
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffloatframe.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Float frame whose anchor is page.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFLOATFRAME_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFLOATFRAME_HXX
+
+#include <xfilter/xfframe.hxx>
+
+/**
+ * @brief
+ * Floating frame on any page.
+ * You can specify it to be on all pages, on odd pages, or on even pages.
+ */
+class XFFloatFrame : public XFFrame
+{
+public:
+
+ /**
+ * @descr output range: [start,end], not [start,end).
+ */
+ XFFloatFrame(sal_Int32 start, sal_Int32 end, bool all);
+
+public:
+ void ToXml(IXFStream *pStrm) override;
+
+private:
+ sal_Int32 m_nStart;
+ sal_Int32 m_nEnd;
+ bool m_bAll;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffont.hxx b/lotuswordpro/inc/xfilter/xffont.hxx
new file mode 100644
index 000000000..f6b394e07
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffont.hxx
@@ -0,0 +1,418 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Font object to serial to xml filter.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONT_HXX
+
+#include <sal/config.h>
+
+#include <salhelper/simplereferenceobject.hxx>
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfdefs.hxx>
+
+#define XFFONT_FLAG_NAME 0X00000001
+#define XFFONT_FLAG_NAME_ASIA 0X00000002
+#define XFFONT_FLAG_NAME_COMPLEX 0X00000004
+
+#define XFFONT_FLAG_SIZE 0X00000008
+#define XFFONT_FLAG_SIZE_ASIA 0X00000010
+#define XFFONT_FLAG_SIZE_COMPLEX 0X00000020
+
+#define XFFONT_FLAG_ITALIC 0X00000040
+#define XFFONT_FLAG_ITALIC_ASIA 0X00000080
+#define XFFONT_FLAG_ITALIC_COMPLEX 0X00000100
+
+#define XFFONT_FLAG_BOLD 0X00000200
+#define XFFONT_FLAG_BOLD_ASIA 0X00000400
+#define XFFONT_FLAG_BOLD_COMPLEX 0X00000800
+
+#define XFFONT_FLAG_UNDERLINE 0X00001000
+#define XFFONT_FLAG_UNDERLINECOLOR 0X00002000
+
+#define XFFONT_FLAG_POSITION 0X00004000
+#define XFFONT_FLAG_SCALE 0X00008000
+#define XFFONT_FLAG_CHARSPACE 0x00010000
+
+#define XFFONT_FLAG_COLOR 0x00020000
+#define XFFONT_FLAG_BGCOLOR 0x00040000
+
+#define XFFONT_FLAG_CROSSOUT 0x00080000
+#define XFFONT_FLAG_RELIEF 0x00100000
+#define XFFONT_FLAG_TRANSFORM 0x00200000
+#define XFFONT_FLAG_EMPHASIZE 0x00400000
+#define XFFONT_FLAG_OUTLINE 0x00800000
+#define XFFONT_FLAG_SHADOW 0x01000000
+#define XFFONT_FLAG_BLINK 0x02000000
+#define XFFONT_FLAG_WIDTHSCALE 0x04000000
+
+/**
+ * @descr
+ * The font struct of openoffice xml filter.
+ * There should be some basic members,ie:
+
+ * font name
+ * font family
+ * font size
+ * font italic
+ * font bold
+ * font underline
+ * font underline color
+ */
+class XFFont: public salhelper::SimpleReferenceObject
+{
+public:
+ XFFont();
+
+public:
+ /**
+ * @descr Set font name.
+ */
+ void SetFontName(const OUString& name);
+
+ /**
+ * @descr Set font name for asia locale.
+ */
+ void SetFontNameAsia(const OUString& name);
+
+ /**
+ * @descr Set font name for BIDI locale.
+ */
+ void SetFontNameComplex(const OUString& name);
+
+ /**
+ * @descr Set font size.
+ */
+ void SetFontSize(sal_Int16 size);
+
+ /**
+ * @descr Set font size for asia locale.
+ */
+ void SetFontSizeAsia(sal_Int16 size);
+
+ /**
+ * @descr Set font size for BIDI locale.
+ */
+ void SetFontSizeComplex(sal_Int16 size);
+
+ /**
+ * @descr Set whether font is italic.
+ */
+ void SetItalic(bool italic);
+
+ /**
+ * @descr Set whether font is italic for asia locale.
+ */
+ void SetItalicAsia(bool italic);
+
+ /**
+ * @descr Set whether font is italic for BIDI locale.
+ */
+ void SetItalicComplex(bool italic);
+
+ /**
+ * @descr Set font bold.
+ */
+ void SetBold(bool bold);
+
+ /**
+ * @descr Set font bold for asia locale.
+ */
+ void SetBoldAsia(bool bold);
+
+ /**
+ * @descr Set font bold for complex locale.
+ */
+ void SetBoldComplex(bool bold);
+
+ /**
+ * @descr Set underline style.
+ */
+ void SetUnderline(enumXFUnderline underline,bool wordByWord=false);
+
+ /**
+ * @descr Set crossout.
+ */
+ void SetCrossout(enumXFCrossout cross);
+
+ /**
+ * @descr Set font transform type,pls refer to enumXFTransform.
+ */
+ void SetTransform(enumXFTransform transform);
+
+ /**
+ * @descr Set upper script or lower script.
+ */
+ void SetPosition(bool bUpperScript = true, sal_Int16 pos = 33, sal_Int16 scale = 58);
+
+ /**
+ * @descr Set font color.
+ */
+ void SetColor(XFColor const & color);
+
+ /**
+ * @descr Set font background color.
+ */
+ void SetBackColor(XFColor const & color);
+ void SetBackColorTransparent();
+
+ //getter:
+ enumXFTransform GetTransform() const;
+
+ sal_Int16 GetFontSize() const;
+ const XFColor& GetColor() const;
+
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFFont const & f1, XFFont const & f2);
+ friend bool operator!=(XFFont const & f1, XFFont const & f2);
+ friend class XFFontFactory;
+private:
+ virtual ~XFFont() override {}
+
+ OUString m_strFontName;
+ OUString m_strFontNameAsia;
+ OUString m_strFontNameComplex;
+ sal_Int16 m_nFontSize;
+ sal_Int16 m_nFontSizeAsia;
+ sal_Int16 m_nFontSizeComplex;
+ bool m_bItalic;
+ bool m_bItalicAsia;
+ bool m_bItalicComplex;
+ bool m_bBold;
+ bool m_bBoldAsia;
+ bool m_bBoldComplex;
+ XFColor m_aUnderlineColor;
+
+ enumXFUnderline m_eUnderline;
+ enumXFCrossout m_eCrossout;
+ enumXFTransform m_eTransform;
+ bool m_bWordByWord;
+ sal_Int16 m_nPosition;
+ sal_Int16 m_nScale;
+ XFColor m_aColor;
+ XFColor m_aBackColor;
+ //The flag defines which variable will be functional
+ sal_uInt32 m_nFlag;
+ bool m_bTransparent;
+};
+
+inline void XFFont::SetFontName(const OUString& name)
+{
+ m_strFontName = name;
+ m_nFlag |= XFFONT_FLAG_NAME;
+
+ SetFontNameAsia(name);
+ SetFontNameComplex(name);
+}
+
+inline void XFFont::SetFontNameAsia(const OUString& name)
+{
+ m_strFontNameAsia = name;
+ m_nFlag |= XFFONT_FLAG_NAME_ASIA;
+}
+
+inline void XFFont::SetFontNameComplex(const OUString& name)
+{
+ m_strFontNameComplex = name;
+ m_nFlag |= XFFONT_FLAG_NAME_COMPLEX;
+}
+
+inline void XFFont::SetFontSize(sal_Int16 size)
+{
+ m_nFontSize = size;
+ m_nFlag |= XFFONT_FLAG_SIZE;
+
+ SetFontSizeAsia(size);
+ SetFontSizeComplex(size);
+}
+
+inline void XFFont::SetFontSizeAsia(sal_Int16 size)
+{
+ m_nFontSizeAsia = size;
+ m_nFlag |= XFFONT_FLAG_SIZE_ASIA;
+}
+
+inline void XFFont::SetFontSizeComplex(sal_Int16 size)
+{
+ m_nFontSizeComplex = size;
+ m_nFlag |= XFFONT_FLAG_SIZE_COMPLEX;
+}
+
+//---------Italic:
+inline void XFFont::SetItalic(bool italic)
+{
+ m_bItalic = italic;
+ m_nFlag |= XFFONT_FLAG_ITALIC;
+
+ SetItalicAsia(italic);
+ SetItalicComplex(italic);
+}
+
+inline void XFFont::SetItalicAsia(bool italic)
+{
+ m_bItalicAsia = italic;
+ m_nFlag |= XFFONT_FLAG_ITALIC_ASIA;
+}
+
+inline void XFFont::SetItalicComplex(bool italic)
+{
+ m_bItalicComplex = italic;
+ m_nFlag |= XFFONT_FLAG_ITALIC_COMPLEX;
+}
+
+//--------Bold
+inline void XFFont::SetBold(bool bold)
+{
+ m_bBold = bold;
+ m_nFlag |= XFFONT_FLAG_BOLD;
+ SetBoldAsia(bold);
+ SetBoldComplex(bold);
+}
+
+inline void XFFont::SetBoldAsia(bool bold)
+{
+ m_bBoldAsia = bold;
+ m_nFlag |= XFFONT_FLAG_BOLD_ASIA;
+}
+
+inline void XFFont::SetBoldComplex(bool bold)
+{
+ m_bBoldComplex = bold;
+ m_nFlag |= XFFONT_FLAG_BOLD_COMPLEX;
+}
+
+//--------Underline:
+inline void XFFont::SetUnderline(enumXFUnderline underline, bool wordByWord)
+{
+ m_eUnderline = underline;
+ m_bWordByWord = wordByWord;
+ m_nFlag |= XFFONT_FLAG_UNDERLINE;
+}
+
+inline void XFFont::SetCrossout(enumXFCrossout cross)
+{
+ m_eCrossout = cross;
+ m_bWordByWord = false;
+ m_nFlag |= XFFONT_FLAG_CROSSOUT;
+}
+
+inline void XFFont::SetTransform(enumXFTransform transform)
+{
+ m_eTransform = transform;
+ m_nFlag |= XFFONT_FLAG_TRANSFORM;
+}
+
+inline void XFFont::SetPosition(bool bUpperScript, sal_Int16 pos, sal_Int16 scale)
+{
+ assert(pos>=0&&pos<=100);
+ assert(scale>0&&scale<=100);
+ m_nFlag |= XFFONT_FLAG_POSITION;
+ m_nPosition = pos;
+ m_nScale = scale;
+ if( bUpperScript )
+ {
+ if( m_nPosition <0 )
+ m_nPosition = -m_nPosition;
+ }
+ else
+ {
+ if( m_nPosition >0 )
+ m_nPosition = -m_nPosition;
+ }
+}
+
+inline void XFFont::SetColor(XFColor const & color)
+{
+ m_nFlag |= XFFONT_FLAG_COLOR;
+ m_aColor = color;
+}
+
+inline void XFFont::SetBackColor(XFColor const & color)
+{
+ m_bTransparent = false;
+ m_nFlag |= XFFONT_FLAG_BGCOLOR;
+ m_aBackColor = color;
+}
+
+inline void XFFont::SetBackColorTransparent()
+{
+ m_bTransparent = true;
+ m_nFlag |= XFFONT_FLAG_BGCOLOR;
+}
+
+inline enumXFTransform XFFont::GetTransform() const
+{
+ return m_eTransform;
+}
+
+inline sal_Int16 XFFont::GetFontSize() const
+{
+ return m_nFontSize;
+}
+
+inline const XFColor& XFFont::GetColor() const
+{
+ return m_aColor;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffontdecl.hxx b/lotuswordpro/inc/xfilter/xffontdecl.hxx
new file mode 100644
index 000000000..18845f50a
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffontdecl.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Font declaration for OOo xml file.This is needed for every font that was
+ * used.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONTDECL_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONTDECL_HXX
+
+#include <rtl/ustring.hxx>
+
+/**
+ * @brief
+ * Font declaration in OOo xml file.
+ * Each font used should be declared.
+ */
+class XFFontDecl
+{
+public:
+ XFFontDecl(const OUString& name, const OUString& family);
+
+public:
+ /**
+ * @descr Get font name.
+ */
+ const OUString& GetFontName() const { return m_strFontName;}
+
+ /**
+ * @descr Get font family.
+ */
+ const OUString& GetFontFamily() const { return m_strFontFamily;}
+
+private:
+ OUString m_strFontName;
+ OUString m_strFontFamily;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffontfactory.hxx b/lotuswordpro/inc/xfilter/xffontfactory.hxx
new file mode 100644
index 000000000..04ecffa0d
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffontfactory.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Factory object for XFFont.It also manages all font life cycle.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONTFACTORY_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONTFACTORY_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include <xfilter/xffont.hxx>
+#include <vector>
+
+/**
+ * @brief
+ * Font factory.
+ * Because font object are so used so often, so make a factory to manager them.
+ * The fonts with same properties will only exist one instance.
+ */
+class XFFontFactory
+{
+public:
+ XFFontFactory();
+ ~XFFontFactory();
+ XFFontFactory(const XFFontFactory&) = delete;
+ XFFontFactory& operator=(XFFontFactory const&) = delete;
+
+private:
+ /**
+ * @descr Add a font. if there exist a font with same properties with pFont, them the font object
+ * will not be added.
+ */
+ void AddFont(rtl::Reference<XFFont> const& pFont);
+
+ /**
+ * @descr Find whether same font object exists.
+ */
+ rtl::Reference<XFFont> FindSameFont(rtl::Reference<XFFont> const& pFont);
+
+ friend class XFStyleContainer;
+
+private:
+ std::vector<rtl::Reference<XFFont>> s_aFonts;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffooter.hxx b/lotuswordpro/inc/xfilter/xffooter.hxx
new file mode 100644
index 000000000..30deea07a
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffooter.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Footer object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTER_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+
+/**
+ * @descr Foot object. It's just a container.
+ */
+class XFFooter : public XFContentContainer
+{
+public:
+ XFFooter()
+ {
+ }
+ virtual void ToXml(IXFStream *pStrm) override
+ {
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "style:footer" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "style:footer" );
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffooterstyle.hxx b/lotuswordpro/inc/xfilter/xffooterstyle.hxx
new file mode 100644
index 000000000..ecddefcaa
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffooterstyle.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Footer style,exist in page-master object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTERSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTERSTYLE_HXX
+
+#include <xfilter/xfheaderstyle.hxx>
+#include <xfilter/xfmargins.hxx>
+
+class XFFooterStyle : public XFHeaderStyle
+{
+public:
+ XFFooterStyle() : XFHeaderStyle(true)
+ {
+ }
+
+ void SetMargins(double left, double right, double top)
+ {
+ if( left != -1 )
+ m_aMargin.SetLeft(left);
+ if( right != -1 )
+ m_aMargin.SetRight(right);
+ if( top != -1 )
+ m_aMargin.SetTop(top);
+ }
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffootnote.hxx b/lotuswordpro/inc/xfilter/xffootnote.hxx
new file mode 100644
index 000000000..76f26c83e
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffootnote.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Foot note object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTNOTE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTNOTE_HXX
+
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+/**
+ * @brief
+ * Foot note object.
+ * Foot note has a label, which is used in page content, and footnote contents in the footnote section.
+ */
+class XFFootNote : public XFContentContainer
+{
+public:
+ XFFootNote();
+
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strID;
+ OUString m_strLabel;
+};
+
+inline XFFootNote::XFFootNote()
+{
+ m_strID = XFGlobal::GenNoteName();
+}
+
+
+inline void XFFootNote::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "text:id", m_strID );
+ pStrm->StartElement( "text:footnote" );
+
+ pAttrList->Clear();
+ if( !m_strLabel.isEmpty() )
+ pAttrList->AddAttribute( "text:label", m_strLabel );
+ pStrm->StartElement( "text:footnote-citation" );
+ if( !m_strLabel.isEmpty() )
+ pStrm->Characters(m_strLabel);
+ pStrm->EndElement( "text:footnote-citation" );
+
+ pAttrList->Clear();
+ pStrm->StartElement( "text:footnote-body" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "text:footnote-body" );
+
+ pStrm->EndElement( "text:footnote" );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xffootnoteconfig.hxx b/lotuswordpro/inc/xfilter/xffootnoteconfig.hxx
new file mode 100644
index 000000000..b24b3c2ac
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xffootnoteconfig.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Footnote config.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTNOTECONFIG_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFOOTNOTECONFIG_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfstyle.hxx>
+
+class XFFootnoteConfig : public XFStyle
+{
+public:
+ XFFootnoteConfig();
+
+public:
+ void SetMasterPage(const OUString& masterPage);
+
+ void SetStartValue(sal_Int32 value);
+
+ void SetRestartOnPage();
+
+ void SetNumPrefix(const OUString& numprefix);
+
+ void SetNumSuffix(const OUString& numsuffix);
+
+ void SetMessageOn(const OUString& message);
+
+ void SetMessageFrom(const OUString& message);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+protected:
+ OUString m_strBodyStyle;
+ OUString m_strCitationStyle;
+ OUString m_strDefaultStyle;
+ OUString m_strMasterPage;
+ OUString m_strNumFmt;
+ OUString m_strNumPrefix;
+ OUString m_strNumSuffix;
+ OUString m_strMessageFrom;
+ OUString m_strMessageOn;
+ sal_Int32 m_nStartValue;
+ sal_Int32 m_nRestartType;
+ bool m_bInsertInPage;
+ bool m_bIsFootnote;
+};
+
+inline XFFootnoteConfig::XFFootnoteConfig()
+{
+ m_nStartValue = 0;
+ m_nRestartType = -1;
+ m_strNumFmt = "1";
+ m_bInsertInPage = true;
+ m_strDefaultStyle = "Footnote";
+ m_strMasterPage = "Footnote";
+ m_strCitationStyle = "Footnote Symbol";
+ m_strBodyStyle = "Footnote anchor";
+ m_bIsFootnote = true;
+}
+
+inline void XFFootnoteConfig::SetMasterPage(const OUString& masterPage)
+{
+ m_strMasterPage = masterPage;
+}
+
+inline void XFFootnoteConfig::SetStartValue(sal_Int32 value)
+{
+ if( value<0 )
+ return;
+ m_nStartValue = value;
+}
+
+inline void XFFootnoteConfig::SetRestartOnPage()
+{
+ m_nRestartType = 0;
+}
+
+inline void XFFootnoteConfig::SetNumPrefix(const OUString& numprefix)
+{
+ m_strNumPrefix = numprefix;
+}
+
+inline void XFFootnoteConfig::SetNumSuffix(const OUString& numsuffix)
+{
+ m_strNumSuffix = numsuffix;
+}
+
+inline void XFFootnoteConfig::SetMessageOn(const OUString& message)
+{
+ m_strMessageOn = message;
+}
+
+inline void XFFootnoteConfig::SetMessageFrom(const OUString& message)
+{
+ m_strMessageFrom = message;
+}
+
+inline void XFFootnoteConfig::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( !m_strCitationStyle.isEmpty() )
+ pAttrList->AddAttribute( "text:citation-style-name", m_strCitationStyle);
+
+ if( !m_strBodyStyle.isEmpty() )
+ pAttrList->AddAttribute( "text:citation-body-style-name", m_strBodyStyle);
+
+ if( !m_strNumPrefix.isEmpty() )
+ pAttrList->AddAttribute( "style:num-prefix", m_strNumPrefix);
+
+ if( !m_strNumSuffix.isEmpty() )
+ pAttrList->AddAttribute( "style:num-suffix", m_strNumSuffix);
+
+ if( !m_strNumFmt.isEmpty() )
+ pAttrList->AddAttribute( "style:num-format", m_strNumFmt);
+
+ if( !m_strDefaultStyle.isEmpty() )
+ pAttrList->AddAttribute( "text:default-style-name", m_strDefaultStyle);
+
+ if( !m_strMasterPage.isEmpty() )
+ pAttrList->AddAttribute( "text:master-page-name", m_strMasterPage);
+
+ pAttrList->AddAttribute( "text:start-value", OUString::number(m_nStartValue) );
+
+ if( m_bIsFootnote )
+ {
+ if( m_nRestartType == -1 )
+ pAttrList->AddAttribute( "text:start-numbering-at", "document" );
+ else if( m_nRestartType == 0 )
+ pAttrList->AddAttribute( "text:start-numbering-at", "page" );
+ else if( m_nRestartType == 1 )
+ pAttrList->AddAttribute( "text:start-numbering-at", "chapter" );
+
+ if( m_bInsertInPage )
+ pAttrList->AddAttribute( "text:footnotes-position", "page" );
+ else
+ pAttrList->AddAttribute( "text:footnotes-position", "document" );
+ }
+
+ if(m_bIsFootnote)
+ {
+ pStrm->StartElement( "text:footnotes-configuration" );
+ if( !m_strMessageOn.isEmpty() )
+ {
+ pStrm->StartElement( "text:footnote-continuation-notice-forward" );
+ pStrm->Characters(m_strMessageOn);
+ pStrm->EndElement( "text:footnote-continuation-notice-forward" );
+ }
+
+ if( !m_strMessageFrom.isEmpty() )
+ {
+ pStrm->StartElement( "text:footnote-continuation-notice-backward" );
+ pStrm->Characters(m_strMessageFrom);
+ pStrm->EndElement( "text:footnote-continuation-notice-backward" );
+ }
+
+ pStrm->EndElement( "text:footnotes-configuration" );
+ }
+ else
+ {
+ pStrm->StartElement( "text:endnotes-configuration" );
+ pStrm->EndElement( "text:endnotes-configuration" );
+ }
+
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfframe.hxx b/lotuswordpro/inc/xfilter/xfframe.hxx
new file mode 100644
index 000000000..8b7ec196b
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfframe.hxx
@@ -0,0 +1,251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Frame object for OOo.This is the basic object for all Shape Layer.
+ * You can reference to the XFFrame object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFRAME_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFRAME_HXX
+
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/xfrect.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+
+#define XFFRAME_FLAG_HEIGHT 0x00000001
+#define XFFRAME_FLAG_MINHEIGHT 0x00000002
+#define XFFRAME_FLAG_MAXHEIGHT 0x00000004
+/**
+ * @brief
+ * Base class for all frame object,include drawing,image,text-box.
+ *
+ * Use SetX(),SetY(),SetWidth(),SetHeight() to set position for the frame.
+ * Only if you set anchor type to enumXFAnchorPage, the SetAnchorPage functions.
+ */
+class XFFrame : public XFContentContainer
+{
+public:
+ XFFrame();
+ explicit XFFrame(bool isTextBox);
+
+ virtual ~XFFrame() override;
+
+public:
+ using XFContentContainer::Add;
+
+ /**
+ * @descr override the add function to adjust z-index.
+ */
+ virtual void Add(XFContent *pContent) override;
+
+ /**
+ * @descr: Set the anchor type for the frame object.
+ */
+ void SetAnchorType(enumXFAnchor type);
+
+ /**
+ * @descr: if it's page anchor,set the page number.
+ */
+ void SetAnchorPage(sal_Int32 page);
+
+ /**
+ * @descr Set frame name.
+ */
+ void SetName(const OUString& name);
+
+ /**
+ * @descr Set z-index of the frame.
+ */
+ void SetZIndex(sal_uInt32 zIndex);
+ /**
+ * @descr Set frame position X.
+ */
+ void SetX(double x);
+
+ /**
+ * @descr Set frame position Y.
+ */
+ void SetY(double y);
+
+ /**
+ * @descr Set frame width.
+ */
+ void SetWidth(double width);
+
+ /**
+ * @descr Set frame height. Be careful SetHeight and SetMinHeight will override each other.
+ */
+ void SetHeight(double height);
+
+ /**
+ * @descr Set frame min-height. Be careful SetHeight and SetMinHeight will override each other.
+ */
+ void SetMinHeight(double minHeight);
+
+ /**
+ * @descr Set frame position.
+ */
+ void SetPosition(double x, double y, double width, double height);
+
+ /**
+ * @descr Set frame position.
+ */
+ void SetPosition(const XFRect& rect);
+
+ /**
+ * @descr: Link the text content of the two frame.
+ */
+ void SetNextLink(const OUString& next);
+
+ /**
+ * @descr Get the frame type. image, drawing or text-box.
+ */
+ enumXFFrameType GetFrameType() const;
+
+ /**
+ * @descr Get content type, enumXFContentFrame.
+ */
+ virtual enumXFContent GetContentType() override;
+
+ /**
+ * @descr serialize.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ void StartFrame(IXFStream *pStrm);
+
+ static void EndFrame(IXFStream *pStrm);
+
+ void AdjustZIndex();
+
+protected:
+ enumXFAnchor m_eAnchor;
+ sal_Int32 m_nAnchorPage;
+ OUString m_strName;
+ sal_uInt32 m_nZIndex;
+ XFRect m_aRect;
+ double m_fMinHeight;
+ OUString m_strNextLink;
+ enumXFFrameType m_eType;
+ sal_uInt32 m_nFrameFlag;
+ bool m_isTextBox;
+};
+
+inline void XFFrame::SetAnchorType(enumXFAnchor anchor)
+{
+ m_eAnchor = anchor;
+}
+
+inline void XFFrame::SetName(const OUString& name)
+{
+ m_strName = name;
+}
+
+inline void XFFrame::SetX(double x)
+{
+ m_aRect.SetX(x);
+}
+
+inline void XFFrame::SetY(double y)
+{
+ m_aRect.SetY(y);
+}
+
+inline void XFFrame::SetWidth(double width)
+{
+ m_aRect.SetWidth(width);
+}
+
+inline void XFFrame::SetHeight(double height)
+{
+ m_aRect.SetHeight(height);
+ m_nFrameFlag |= XFFRAME_FLAG_HEIGHT;
+ m_nFrameFlag &= XFFRAME_FLAG_HEIGHT;
+}
+
+inline void XFFrame::SetMinHeight(double minHeight)
+{
+ m_fMinHeight = minHeight;
+ m_nFrameFlag |= XFFRAME_FLAG_MINHEIGHT;
+ m_nFrameFlag &= XFFRAME_FLAG_MINHEIGHT;
+}
+
+inline void XFFrame::SetPosition(double x, double y, double width, double height)
+{
+ m_aRect.SetStartPoint(XFPoint(x,y));
+ m_aRect.SetSize(width,height);
+ m_nFrameFlag |= XFFRAME_FLAG_HEIGHT;
+}
+
+inline void XFFrame::SetPosition(const XFRect& rect)
+{
+ m_aRect = rect;
+}
+
+inline void XFFrame::SetNextLink(const OUString& next)
+{
+ m_strNextLink = next;
+}
+
+inline void XFFrame::SetAnchorPage(sal_Int32 page)
+{
+ m_nAnchorPage = page;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfframestyle.hxx b/lotuswordpro/inc/xfilter/xfframestyle.hxx
new file mode 100644
index 000000000..1ef423318
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfframestyle.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Frame object style for OOo.
+ * You can reference to the XFFrame object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFRAMESTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFRAMESTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfpadding.hxx>
+#include <memory>
+
+class XFBorders;
+class XFColumns;
+class XFShadow;
+class XFBGImage;
+
+/**
+ * @brief
+ * Style for all frame objects.
+ */
+class XFFrameStyle : public XFStyle
+{
+public:
+ XFFrameStyle();
+
+ virtual ~XFFrameStyle() override;
+
+public:
+ void SetWrapType(enumXFWrap wrap);
+
+ /**
+ * @descr: space between frame and paragraph text.
+ */
+ void SetMargins(double left, double right, double top, double bottom);
+
+ /**
+ * @descr: space between frame and text inside frame.
+ */
+ void SetPadding(double left, double right, double top, double bottom);
+
+ /**
+ * @descr: set the border property of the frame.
+ */
+ void SetBorders(std::unique_ptr<XFBorders> pBorders);
+
+ /**
+ * @descr: set the column property of the frame.
+ */
+ void SetColumns(XFColumns *pColumns);
+
+ /**
+ * @descr: set the shadow object the frame.
+ */
+ void SetShadow(XFShadow *pShadow);
+
+ /**
+ * @descr: set the background image of the frame.
+ */
+ void SetBackImage(std::unique_ptr<XFBGImage>& rImage);
+
+ /**
+ * @descr: set the background color of the frame.
+ */
+ void SetBackColor(XFColor const & color);
+
+ /**
+ * @descr Set whether frame is protected. There are three properties that can be protected, content,size and position.
+ */
+ void SetProtect(bool content, bool size, bool pos);
+
+ /**
+ * @descr Set text dir.
+ */
+ void SetTextDir(enumXFTextDir dir);
+
+ /**
+ * @descr Set horizontal position type.
+ */
+ void SetXPosType(enumXFFrameXPos pos, enumXFFrameXRel rel);
+
+ /**
+ * @descr Set vertical position type.
+ */
+ void SetYPosType(enumXFFrameYPos pos, enumXFFrameYRel rel);
+
+ void SetTransparency(sal_Int16 nTransparency);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+protected:
+ enumXFWrap m_eWrap;
+ XFPadding m_aPad;
+ XFMargins m_aMargins;
+ std::unique_ptr<XFBorders> m_pBorders;
+ std::unique_ptr<XFColumns> m_pColumns;
+ std::unique_ptr<XFShadow> m_pShadow;
+ std::unique_ptr<XFBGImage> m_pBGImage;
+ XFColor m_aBackColor;
+ bool m_bProtectContent;
+ bool m_bProtectSize;
+ bool m_bProtectPos;
+ sal_Int16 m_nTransparency;
+
+ enumXFTextDir m_eTextDir;
+ enumXFFrameXPos m_eXPos;
+ enumXFFrameXRel m_eXRel;
+ enumXFFrameYPos m_eYPos;
+ enumXFFrameYRel m_eYRel;
+};
+
+inline void XFFrameStyle::SetWrapType(enumXFWrap wrap)
+{
+ m_eWrap = wrap;
+}
+
+inline void XFFrameStyle::SetMargins(double left, double right,double top, double bottom)
+{
+ if( left != -1 )
+ m_aMargins.SetLeft(left);
+ if( right != -1 )
+ m_aMargins.SetRight(right);
+ if( top != -1 )
+ m_aMargins.SetTop(top);
+ if( bottom != -1 )
+ m_aMargins.SetBottom( bottom );
+}
+
+inline void XFFrameStyle::SetPadding(double left, double right,double top, double bottom)
+{
+ if( left != -1 )
+ m_aPad.SetLeft(left);
+ if( right != -1 )
+ m_aPad.SetRight(right);
+ if( top != -1 )
+ m_aPad.SetTop(top);
+ if( bottom != -1 )
+ m_aPad.SetBottom( bottom );
+}
+
+inline void XFFrameStyle::SetBackColor(XFColor const & color)
+{
+ m_aBackColor = color;
+}
+
+inline void XFFrameStyle::SetTextDir(enumXFTextDir dir)
+{
+ m_eTextDir = dir;
+}
+
+inline void XFFrameStyle::SetProtect(bool content, bool size, bool pos)
+{
+ m_bProtectContent = content;
+ m_bProtectSize = size;
+ m_bProtectPos = pos;
+}
+
+inline void XFFrameStyle::SetXPosType(enumXFFrameXPos pos, enumXFFrameXRel rel)
+{
+ m_eXPos = pos;
+ m_eXRel = rel;
+}
+
+inline void XFFrameStyle::SetYPosType(enumXFFrameYPos pos, enumXFFrameYRel rel)
+{
+ m_eYPos = pos;
+ m_eYRel = rel;
+}
+
+inline void XFFrameStyle::SetTransparency(sal_Int16 nTransparency)
+{
+ m_nTransparency = nTransparency;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfglobal.hxx b/lotuswordpro/inc/xfilter/xfglobal.hxx
new file mode 100644
index 000000000..d3bd4d3f1
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfglobal.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Global functions or include files that are needed.
+ * It's all for the full filter.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFGLOBAL_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFGLOBAL_HXX
+
+#include <rtl/ustring.hxx>
+
+#define PI 3.1415926
+#define FLOAT_MIN 0.001
+#define MAX2(a,b) (((a) > (b)) ? (a) : (b))
+#define MAX3(a,b,c) MAX2(a,MAX2(b,c))
+#define MIN2(a,b) (((a) < (b)) ? (a) : (b))
+#define MIN3(a,b,c) MIN2(a,MIN2(b,c))
+#define FABS(f) (f>0?f:-f)
+
+void XFGlobalReset();
+
+/**
+ * @brief
+ * Global object, it manages all global variables for the full filter.
+ * Before loading a file, we'll need to reset all global variables.
+ * XFGlobal::Reset can do this for you.
+ */
+class XFGlobal
+{
+public:
+ /**
+ * @descr Generate a name for the section.
+ */
+ static OUString GenSectionName();
+
+ /**
+ * @descr Gen a name for the frame.
+ */
+ static OUString GenFrameName();
+
+ /**
+ * @descr Generate a name for a table.
+ */
+ static OUString GenTableName();
+
+ /**
+ * @descr Generate a name for a note.
+ */
+ static OUString GenNoteName();
+
+ /**
+ * @descr Generate a name for the stroke style.
+ */
+ static OUString GenStrokeDashName();
+
+ /**
+ * @descr Generate a name for the area fill style.
+ */
+ static OUString GenAreaName();
+
+ /**
+ * @descr Generate a name for an image object
+ */
+ static OUString GenImageName();
+
+ /**
+ * @descr Reset all global variables.
+ */
+ static void Reset();
+
+public:
+ static int s_nSectionID;
+ static int s_nFrameID;
+ static int s_nNoteID;
+ static int s_nStrokeDashID;
+ static int s_nAreaID;
+ static int s_nImageID;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfheader.hxx b/lotuswordpro/inc/xfilter/xfheader.hxx
new file mode 100644
index 000000000..5b101518f
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfheader.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Header object. Sub object of master page.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFHEADER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFHEADER_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+
+class XFHeader : public XFContentContainer
+{
+public:
+ XFHeader()
+ {
+ }
+public:
+ virtual void ToXml(IXFStream *pStrm) override
+ {
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pStrm->StartElement( "style:header" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "style:header" );
+ }
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfheaderstyle.hxx b/lotuswordpro/inc/xfilter/xfheaderstyle.hxx
new file mode 100644
index 000000000..7e5a3bda9
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfheaderstyle.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Header style,exist in page-master object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFHEADERSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFHEADERSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfpadding.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <memory>
+
+/**
+ * @brief
+ * Header style object.
+ */
+class XFBGImage;
+class XFHeaderStyle : public XFStyle
+{
+public:
+ explicit XFHeaderStyle(bool isFooter=false);
+
+ virtual ~XFHeaderStyle() override;
+
+public:
+ /**
+ * @descr Set margins for header style.
+ */
+ void SetMargins(double left, double right, double bottom);
+
+ void SetDynamicSpace(bool dynamic);
+
+ /**
+ * @descr Set header fixed height.
+ */
+ void SetHeight(double height);
+
+ /**
+ * @descr Set header min height.
+ */
+ void SetMinHeight(double minHeight);
+
+ /**
+ * @descr Set header shadow.
+ */
+ void SetShadow(XFShadow *pShadow);
+
+ /**
+ * @descr Set header borders.
+ */
+ void SetBorders(std::unique_ptr<XFBorders> pBorders);
+
+ void SetBackImage(std::unique_ptr<XFBGImage>& rImage);
+
+ /**
+ * @descr Set header background color.
+ */
+ void SetBackColor(XFColor color);
+
+ /**
+ * @descr Output header style object.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+protected:
+ bool m_bIsFooter;
+ bool m_bDynamicSpace;
+ double m_fHeight;
+ double m_fMinHeight;
+ XFMargins m_aMargin;
+ std::unique_ptr<XFShadow> m_pShadow;
+ XFPadding m_aPadding;
+ std::unique_ptr<XFBorders> m_pBorders;
+ std::unique_ptr<XFBGImage> m_pBGImage;
+ XFColor m_aBackColor;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfhyperlink.hxx b/lotuswordpro/inc/xfilter/xfhyperlink.hxx
new file mode 100644
index 000000000..f44edab39
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfhyperlink.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Hyperlink object for OOo xml filter.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFHYPERLINK_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFHYPERLINK_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+
+class XFHyperlink : public XFContent
+{
+public:
+ XFHyperlink();
+
+public:
+ void SetHRef(const OUString& href);
+
+ void SetText(const OUString& text);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strHRef;
+ OUString m_strName;
+ OUString m_strFrame;
+ OUString m_strText;
+};
+
+inline XFHyperlink::XFHyperlink()
+{
+ m_strFrame = "_self";
+}
+
+inline void XFHyperlink::SetHRef(const OUString& href)
+{
+ m_strHRef = href;
+}
+
+inline void XFHyperlink::SetText(const OUString& text)
+{
+ m_strText = text;
+}
+
+inline void XFHyperlink::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "xlink:type", "simple" );
+ pAttrList->AddAttribute( "xlink:href", m_strHRef );
+ if( !m_strName.isEmpty() )
+ pAttrList->AddAttribute( "office:name", m_strName );
+ pAttrList->AddAttribute( "office:target-frame-name", m_strFrame );
+ pAttrList->AddAttribute( "xlink:show", "replace" );
+ pStrm->StartElement( "text:a" );
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+ pStrm->StartElement( "text:span" );
+ if( !m_strText.isEmpty() )
+ pStrm->Characters(m_strText);
+ else
+ pStrm->Characters(m_strHRef);
+ pStrm->EndElement( "text:span" );
+
+ pStrm->EndElement( "text:a" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfimage.hxx b/lotuswordpro/inc/xfilter/xfimage.hxx
new file mode 100644
index 000000000..775d301cc
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfimage.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Image object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFIMAGE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFIMAGE_HXX
+
+#include <xfilter/xfframe.hxx>
+
+/**
+ * @brief
+ * Image object.
+ * There are two way to import an image, file link or base64 stream.
+ */
+class XFImage : public XFFrame
+{
+public:
+ XFImage();
+
+public:
+ /**
+ * @descr Use file link source.a
+ */
+ void SetFileURL(const OUString& url);
+
+ /**
+ * @descr Use base64 stream.
+ */
+ void SetImageData(sal_uInt8 const* buf, int len);
+
+ /**
+ * @descr Output image.
+ */
+ virtual void ToXml(IXFStream* pStrm) override;
+
+private:
+ OUString m_strImageFile;
+ OUString m_strData;
+ bool m_bUseLink;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfimagestyle.hxx b/lotuswordpro/inc/xfilter/xfimagestyle.hxx
new file mode 100644
index 000000000..1601984fb
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfimagestyle.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Image style object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFIMAGESTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFIMAGESTYLE_HXX
+
+#include <xfilter/xfframestyle.hxx>
+
+class XFImageStyle : public XFFrameStyle
+{
+public:
+ XFImageStyle();
+
+public:
+ void SetBrightness(sal_Int32 brightness);
+
+ void SetContrast(sal_Int32 contrast);
+
+ void SetClip(double left, double right, double top, double bottom);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ sal_Int32 m_nBrightness;
+ sal_Int32 m_nContrast;
+ double m_fClipLeft;
+ double m_fClipRight;
+ double m_fClipTop;
+ double m_fClipBottom;
+};
+
+inline void XFImageStyle::SetBrightness(sal_Int32 brightness)
+{
+ m_nBrightness = brightness;
+}
+
+inline void XFImageStyle::SetContrast(sal_Int32 contrast)
+{
+ m_nContrast = contrast;
+}
+
+inline void XFImageStyle::SetClip(double left, double right, double top, double bottom)
+{
+ m_fClipLeft = left;
+ m_fClipRight = right;
+ m_fClipTop = top;
+ m_fClipBottom = bottom;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfindex.hxx b/lotuswordpro/inc/xfilter/xfindex.hxx
new file mode 100644
index 000000000..f5bbd7172
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfindex.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Represents index source, index body and index entry.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFINDEX_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFINDEX_HXX
+#include <map>
+#include <vector>
+
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <rtl/ref.hxx>
+
+class XFIndex;
+class XFIndexTemplate;
+class XFParagraph;
+
+/**
+ * @brief
+ * Index template.
+ * When index update, the template is used to decide the index body.
+ */
+class XFIndexTemplate : public XFContent
+{
+public:
+ XFIndexTemplate();
+
+public:
+ /**
+ * @descr Set template level.
+ */
+ void SetLevel(const OUString& level);
+ /**
+ * @descr Set style.
+ */
+ void SetStyleName(const OUString& style) override;
+ /**
+ * @descr Add an entry in the template.
+ */
+ void AddEntry(enumXFIndexTemplate entry, const OUString& styleName);
+
+ /**
+ * @descr Add a tab entry in the template.
+ */
+ void AddTabEntry(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter, const OUString& styleName);
+
+ /**
+ * @descr Add an entry in the template.
+ */
+ void AddTextEntry(const OUString& sSpan, const OUString& styleName);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ /**
+ * @descr Helper function.
+ */
+ void SetTagName(const OUString& tag);
+
+ friend class XFIndex;
+private:
+ OUString m_nLevel;
+ OUString m_strStyle;
+ enumXFTab m_eTabType;
+ double m_fTabLength;
+ OUString m_strTabDelimiter;
+ OUString m_strTabLeader;
+ OUString m_strTagName;
+ typedef std::pair<enumXFIndexTemplate, OUString> TOCTEMPLATE_ENTRY_TYPE;
+ std::vector<TOCTEMPLATE_ENTRY_TYPE> m_aEntries; // template entry + text style
+ std::map<sal_uInt16, OUString> m_aTextEntries;
+};
+
+/**
+ * @brief
+ * Index, include index template, index body.
+ */
+class XFIndex : public XFContentContainer
+{
+public:
+ XFIndex();
+
+ virtual ~XFIndex() override;
+
+public:
+ /**
+ * @descr Set index type.
+ */
+ void SetIndexType(enumXFIndex type);
+
+ /**
+ * @descr Add index template entry.
+ */
+ void AddTemplate(const OUString& level, const OUString& style, XFIndexTemplate* templ);
+
+ /**
+ * @descr Set if protected index to prevent handy-revise.
+ */
+ void SetProtected(bool protect);
+
+ /**
+ * @descr Set separator.
+ */
+ void SetSeparator(bool sep);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ void AddTocSource(sal_uInt16 nLevel, const OUString& sStyleName);
+
+private:
+ enumXFIndex m_eType;
+ OUString m_strTitle;
+ bool m_bProtect;
+ bool m_bSeparator;
+
+ std::vector<rtl::Reference<XFIndexTemplate>> m_aTemplates; // template entry + style
+
+ #define MAX_TOC_LEVEL 10
+ std::vector<OUString> m_aTOCSource[MAX_TOC_LEVEL+1];
+};
+
+inline XFIndexTemplate::XFIndexTemplate()
+ : m_eTabType(enumXFTabNone)
+ , m_fTabLength(0.0)
+{
+ m_nLevel = OUString::number(0);
+}
+
+inline void XFIndexTemplate::SetLevel(const OUString& level)
+{
+ m_nLevel = level;
+}
+inline void XFIndexTemplate::SetStyleName(const OUString& style)
+{
+ m_strStyle = style;
+}
+
+inline void XFIndexTemplate::SetTagName(const OUString& tag)
+{
+ m_strTagName = tag;
+}
+
+inline void XFIndexTemplate::AddEntry(enumXFIndexTemplate entry, const OUString& styleName)
+{
+ std::pair<enumXFIndexTemplate, OUString> pair(entry, styleName);
+ m_aEntries.push_back(pair);
+}
+
+inline void XFIndexTemplate::AddTabEntry(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter, const OUString& styleName)
+{
+ m_eTabType = type;
+ m_strTabLeader = OUString( leader );
+ m_strTabDelimiter = OUString( delimiter );
+ m_fTabLength = len;
+
+ AddEntry(enumXFIndexTemplateTab, styleName);
+}
+
+inline void XFIndexTemplate::AddTextEntry(const OUString& sText, const OUString& styleName)
+{
+ sal_uInt16 nLen = m_aEntries.size();
+ AddEntry(enumXFIndexTemplateSpan, styleName);
+
+ m_aTextEntries[nLen] = sText;
+}
+
+inline void XFIndex::SetIndexType(enumXFIndex type)
+{
+ m_eType = type;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfinputlist.hxx b/lotuswordpro/inc/xfilter/xfinputlist.hxx
new file mode 100644
index 000000000..8a5a70e1c
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfinputlist.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * input list field.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFINPUTLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFINPUTLIST_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+#include <vector>
+
+/**
+ * @brief
+ * input list field.
+ */
+class XFInputList : public XFContent
+{
+public:
+ void SetName(const OUString& sName)
+ {
+ m_strName = sName;
+ }
+
+ void SetLabels(const std::vector<OUString>& list)
+ {
+ m_list=list;
+ }
+
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+ OUString m_strName;
+ std::vector<OUString> m_list;
+};
+
+inline void XFInputList::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "text:name", m_strName );
+ pStrm->StartElement( "text:drop-down" );
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:value", " " );
+ pStrm->StartElement( "text:label" );
+ pStrm->EndElement( "text:label" );
+ for(size_t i=0; i< m_list.size();i++)
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:value", m_list[i] );
+ pStrm->StartElement( "text:label" );
+ pStrm->EndElement( "text:label" );
+ }
+ pStrm->EndElement( "text:drop-down" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xflinebreak.hxx b/lotuswordpro/inc/xfilter/xflinebreak.hxx
new file mode 100644
index 000000000..a5fc5054b
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xflinebreak.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**************************************************************************
+ * @file
+ * Line break object,<text:line-break/>
+ *************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINEBREAK_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINEBREAK_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+
+class XFLineBreak : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+inline void XFLineBreak::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pStrm->StartElement( "text:line-break" );
+ pStrm->EndElement( "text:line-break" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xflineheight.hxx b/lotuswordpro/inc/xfilter/xflineheight.hxx
new file mode 100644
index 000000000..cffff2457
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xflineheight.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line height for paragraph.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINEHEIGHT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINEHEIGHT_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfdefs.hxx>
+
+class XFLineHeight
+{
+public:
+ XFLineHeight()
+ {
+ Reset();
+ }
+public:
+ void SetHeight(double value);
+
+ void SetLeastHeight(double value);
+
+ void SetPercent(sal_Int32 value);
+
+ void SetSpace(double value);
+
+ void Reset();
+
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFLineHeight const & indent1, XFLineHeight const & indent2);
+ friend bool operator!=(XFLineHeight const & indent1, XFLineHeight const & indent2);
+private:
+ union{
+ sal_Int32 m_nValue;
+ double m_fValue;
+ }m_Value;
+ enumLHType m_eType;
+};
+
+inline void XFLineHeight::SetHeight(double value)
+{
+ m_Value.m_fValue = value;
+ m_eType = enumLHHeight;
+}
+
+inline void XFLineHeight::SetLeastHeight(double value)
+{
+ m_Value.m_fValue = value;
+ m_eType = enumLHLeast;
+}
+
+inline void XFLineHeight::SetPercent(sal_Int32 value)
+{
+ m_Value.m_nValue = value;
+ m_eType = enumLHPercent;
+}
+inline void XFLineHeight::SetSpace(double value)
+{
+ m_Value.m_fValue = value;
+ m_eType = enumLHSpace;
+}
+inline void XFLineHeight::Reset()
+{
+ m_eType = enumLHNone;
+ m_Value.m_fValue = 0;
+}
+
+inline void XFLineHeight::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ switch(m_eType)
+ {
+ case enumLHNone:
+ return;
+ case enumLHHeight:
+ pAttrList->AddAttribute( "fo:line-height",OUString::number(m_Value.m_fValue) + "cm" );
+ break;
+ case enumLHLeast:
+ pAttrList->AddAttribute( "style:line-height-at-least",OUString::number(m_Value.m_fValue) + "cm" );
+ break;
+ case enumLHPercent:
+ pAttrList->AddAttribute( "fo:line-height", OUString::number(m_Value.m_nValue) + "%" );
+ break;
+ case enumLHSpace:
+ pAttrList->AddAttribute( "style:line-spacing", OUString::number(m_Value.m_fValue) + "cm" );
+ break;
+ }
+}
+
+inline bool operator==(XFLineHeight const & lh1, XFLineHeight const & lh2)
+{
+ if( lh1.m_eType != lh2.m_eType )
+ return false;
+ if( lh1.m_eType == enumLHPercent )
+ {
+ if( lh1.m_Value.m_nValue != lh2.m_Value.m_nValue )
+ return false;
+ }
+ else
+ {
+ if( lh1.m_Value.m_fValue != lh2.m_Value.m_fValue )
+ return false;
+ }
+ return true;
+}
+
+inline bool operator!=(XFLineHeight const & lh1, XFLineHeight const & lh2)
+{
+ return !(lh1==lh2);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xflinenumberconfig.hxx b/lotuswordpro/inc/xfilter/xflinenumberconfig.hxx
new file mode 100644
index 000000000..5c0516bce
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xflinenumberconfig.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line numbering config for the full document.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINENUMBERCONFIG_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINENUMBERCONFIG_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfstyle.hxx>
+
+class XFLineNumberConfig : public XFStyle
+{
+public:
+ XFLineNumberConfig();
+
+public:
+ void SetNumberOffset(double offset);
+
+ void SetNumberPosition(enumXFLineNumberPos pos);
+
+ void SetNumberIncrement(sal_Int32 increment);
+
+ void SetRestartOnPage(bool restart = true);
+
+ void SetCountEmptyLines(bool empty = true);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ enumXFLineNumberPos m_ePosition;
+ double m_fOffset;
+ sal_Int32 m_nIncrement;
+ static const sal_Int32 m_nSepIncrement = 3;
+ OUString m_strSeparator;
+ OUString m_strNumFmt;
+ OUString m_strTextStyle;
+ bool m_bRestartOnPage;
+ bool m_bCountEmptyLines;
+};
+
+inline XFLineNumberConfig::XFLineNumberConfig()
+ : m_ePosition(enumXFLineNumberLeft)
+ , m_fOffset(0)
+ , m_nIncrement(5)
+ , m_bRestartOnPage(false)
+ , m_bCountEmptyLines(true)
+{}
+
+inline void XFLineNumberConfig::SetNumberOffset(double offset)
+{
+ m_fOffset = offset;
+}
+
+inline void XFLineNumberConfig::SetNumberPosition(enumXFLineNumberPos position)
+{
+ m_ePosition = position;
+}
+
+inline void XFLineNumberConfig::SetNumberIncrement(sal_Int32 increment)
+{
+ m_nIncrement = increment;
+}
+
+inline void XFLineNumberConfig::SetRestartOnPage(bool restart)
+{
+ m_bRestartOnPage = restart;
+}
+
+inline void XFLineNumberConfig::SetCountEmptyLines(bool empty)
+{
+ m_bCountEmptyLines = empty;
+}
+
+inline void XFLineNumberConfig::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !m_strTextStyle.isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", m_strTextStyle );
+ pAttrList->AddAttribute( "text:offset", OUString::number(m_fOffset) + "cm" );
+ pAttrList->AddAttribute( "style:num-format", m_strNumFmt );
+ //position:
+ if( m_ePosition == enumXFLineNumberLeft )
+ pAttrList->AddAttribute( "text:number-position", "left" );
+ else if( m_ePosition == enumXFLineNumberRight )
+ pAttrList->AddAttribute( "text:number-position", "right" );
+ else if( m_ePosition == enumXFLineNumberInner )
+ pAttrList->AddAttribute( "text:number-position", "inner" );
+ else if( m_ePosition == enumXFLineNumberOuter )
+ pAttrList->AddAttribute( "text:number-position", "outer" );
+
+ pAttrList->AddAttribute( "text:increment", OUString::number(m_nIncrement) );
+
+ if( m_bRestartOnPage )
+ pAttrList->AddAttribute( "text:restart-on-page", "true" );
+ else
+ pAttrList->AddAttribute( "text:restart-on-page", "false" );
+
+ if( m_bCountEmptyLines )
+ pAttrList->AddAttribute( "text:count-empty-lines", "true" );
+ else
+ pAttrList->AddAttribute( "text:count-empty-lines", "false" );
+
+ pAttrList->AddAttribute( "text:count-in-floating-frames", "false" );
+
+ pStrm->StartElement( "text:linenumbering-configuration" );
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:increment", OUString::number(m_nSepIncrement) );
+ pStrm->StartElement( "text:linenumbering-separator" );
+ pStrm->Characters(m_strSeparator);
+ pStrm->EndElement( "text:linenumbering-separator" );
+
+ pStrm->EndElement( "text:linenumbering-configuration" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xflist.hxx b/lotuswordpro/inc/xfilter/xflist.hxx
new file mode 100644
index 000000000..bd95e84ef
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xflist.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Base list object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLIST_HXX
+
+#include <xfilter/xfcontentcontainer.hxx>
+
+class XFListItem;
+
+/**
+ * @brief
+ * list object for order-list and unordered-list.
+ */
+class XFList : public XFContentContainer
+{
+public:
+ XFList();
+
+ virtual ~XFList() override;
+
+public:
+ /**
+ * @descr Set whether it's an ordered list or an unordered list.
+ */
+ void SetOrdered(bool ordered);
+
+ /**
+ * @descr Set whether to continue to number list.
+ */
+ void SetContinueNumber(bool bContinueNumber);
+
+ /**
+ * @descr Output list object.
+ */
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ bool m_bOrdered;
+ bool m_bContinueNumber;
+};
+
+inline void XFList::SetOrdered(bool ordered)
+{
+ m_bOrdered = ordered;
+}
+
+inline void XFList::SetContinueNumber(bool bContinueNumber)
+{
+ m_bContinueNumber = bContinueNumber;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xflistitem.hxx b/lotuswordpro/inc/xfilter/xflistitem.hxx
new file mode 100644
index 000000000..228176217
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xflistitem.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * List item.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLISTITEM_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLISTITEM_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+
+class XFListItem : public XFContentContainer
+{
+public:
+ XFListItem();
+
+public:
+ void SetIsHeader();
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ bool m_bIsHeader;
+};
+
+inline XFListItem::XFListItem()
+{
+ m_bIsHeader = false;
+}
+
+inline void XFListItem::SetIsHeader()
+{
+ m_bIsHeader = true;
+}
+
+inline void XFListItem::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+
+ if( !m_bIsHeader )
+ {
+ pStrm->StartElement( "text:list-item" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "text:list-item" );
+ }
+ else
+ {
+ pStrm->StartElement( "text:list-header" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "text:list-header" );
+ }
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfliststyle.hxx b/lotuswordpro/inc/xfilter/xfliststyle.hxx
new file mode 100644
index 000000000..9937ea85a
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfliststyle.hxx
@@ -0,0 +1,260 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Styles for ordered list and unordered list.
+************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLISTSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLISTSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfnumfmt.hxx>
+#include <memory>
+
+class IXFStream;
+
+enum enumXFListLevel
+{
+ enumXFListLevelBullet,
+ enumXFListLevelNumber,
+ enumXFListLevelImage
+};
+
+/**************************************************************************
+ * @descr
+ * Bullet style wrapper,the underline bullet type can be:
+ * number,image,or bullet.
+ *************************************************************************/
+class XFListLevel
+{
+public:
+ XFListLevel();
+
+ virtual ~XFListLevel(){}
+
+ XFListLevel(XFListLevel const &) = default;
+ XFListLevel(XFListLevel &&) = default;
+ XFListLevel & operator =(XFListLevel const &) = default;
+ XFListLevel & operator =(XFListLevel &&) = default;
+
+ void SetListlevelType(enumXFListLevel type);
+
+ void SetLevel(sal_Int16 level);
+
+ void SetDisplayLevel(sal_Int16 nDisplayLevel);
+
+ void SetIndent(double indent);
+
+ void SetMinLabelWidth(double labelWidth);
+
+ void SetMinLabelDistance(double distance);
+
+ void SetAlignType(enumXFAlignType align);
+
+ virtual void ToXml(IXFStream *pStrm);
+
+ friend class XFListStyle;
+protected:
+ sal_Int16 m_nLevel;
+ sal_Int16 m_nDisplayLevel;
+ double m_fIndent;
+ double m_fMinLabelWidth;
+ double m_fMinLabelDistance;
+ enumXFAlignType m_eAlign;
+ enumXFListLevel m_eListType;
+};
+
+class XFListlevelNumber : public XFListLevel
+{
+public:
+ XFListlevelNumber()
+ {
+ m_eListType = enumXFListLevelNumber;
+ }
+public:
+ void SetNumFmt(XFNumFmt const & fmt)
+ {
+ m_aNumFmt = fmt;
+ }
+
+ void SetStartValue(sal_Int16 start)
+ {
+ m_aNumFmt.SetStartValue(start);
+ }
+
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+ XFNumFmt m_aNumFmt;
+};
+
+class XFListLevelBullet : public XFListLevel
+{
+public:
+ XFListLevelBullet()
+ {
+ m_eListType = enumXFListLevelBullet;
+ }
+
+ void SetBulletChar(OUString const & ch)
+ {
+ m_chBullet = ch;
+ }
+ void SetPrefix(const OUString& prefix)
+ {
+ m_aNumFmt.SetPrefix(prefix);
+ }
+ void SetSuffix(const OUString& suffix)
+ {
+ m_aNumFmt.SetSuffix(suffix);
+ }
+ void SetFontName(const OUString& name)
+ {
+ m_strFontName = name;
+ }
+
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+ XFNumFmt m_aNumFmt;
+ OUString m_chBullet;
+ OUString m_strFontName;
+};
+
+//not complete.
+class XFListLevelImage : public XFListLevel
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+};
+
+class XFListStyle : public XFStyle
+{
+public:
+ XFListStyle();
+
+ XFListStyle(const XFListStyle& other);
+
+ XFListStyle& operator=(const XFListStyle& other) = delete;
+
+ virtual ~XFListStyle() override;
+
+public:
+ void SetDisplayLevel(sal_Int32 level, sal_Int16 nShowLevel);
+
+ void SetListPosition(sal_Int32 level,
+ double indent,
+ double minLabelWidth,
+ double minLabelDistance,
+ enumXFAlignType align=enumXFAlignStart
+ );
+
+ void SetListBullet(sal_Int32 level,
+ OUString const & bullet_char,
+ const OUString& fontname,
+ const OUString& prefix,
+ const OUString& suffix
+ );
+
+ void SetListNumber( sal_Int32 level, XFNumFmt const & numFmt, sal_Int16 nStartValue );
+
+ virtual enumXFStyle GetStyleFamily() override
+ {
+ return enumXFStyleList;
+ }
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ std::unique_ptr<XFListLevel> m_pListLevels[10];
+};
+
+inline void XFListLevel::SetListlevelType(enumXFListLevel type)
+{
+ m_eListType = type;
+}
+
+inline void XFListLevel::SetAlignType(enumXFAlignType align)
+{
+ m_eAlign = align;
+}
+
+inline void XFListLevel::SetLevel(sal_Int16 level)
+{
+ m_nLevel = level;
+}
+
+inline void XFListLevel::SetDisplayLevel(sal_Int16 nDisplayLevel)
+{
+ m_nDisplayLevel = nDisplayLevel;
+}
+
+inline void XFListLevel::SetIndent(double indent)
+{
+ m_fIndent = indent;
+}
+
+inline void XFListLevel::SetMinLabelWidth(double labelWidth)
+{
+ m_fMinLabelWidth = labelWidth;
+}
+
+inline void XFListLevel::SetMinLabelDistance(double distance)
+{
+ m_fMinLabelDistance = distance;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfmargins.hxx b/lotuswordpro/inc/xfilter/xfmargins.hxx
new file mode 100644
index 000000000..0eafc0a46
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfmargins.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Margins object, include left margin,right margin,top margin and bottom margin.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFMARGINS_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFMARGINS_HXX
+
+#include <xfilter/ixfstream.hxx>
+
+#define XFMARGINS_FLAG_LEFT 0x00000001
+#define XFMARGINS_FLAG_RIGHT 0x00000002
+#define XFMARGINS_FLAG_TOP 0x00000004
+#define XFMARGINS_FLAG_BOTTOM 0x00000008
+
+class XFMargins
+{
+public:
+ XFMargins();
+public:
+ void Reset();
+ void SetLeft(double left);
+ void SetRight(double right);
+ void SetTop(double top);
+ void SetBottom(double bottom);
+
+ double GetLeft() const;
+ double GetTop() const;
+
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFMargins const & indent1, XFMargins const & indent2);
+ friend bool operator!=(XFMargins const & indent1, XFMargins const & indent2);
+private:
+ double m_fLeft;
+ double m_fRight;
+ double m_fTop;
+ double m_fBottom;
+ int m_nFlag;
+};
+
+inline void XFMargins::SetLeft(double left)
+{
+ m_fLeft = left;
+ m_nFlag |= XFMARGINS_FLAG_LEFT;
+}
+
+inline void XFMargins::SetRight(double right)
+{
+ m_fRight = right;
+ m_nFlag |= XFMARGINS_FLAG_RIGHT;
+}
+
+inline void XFMargins::SetTop(double top)
+{
+ m_fTop = top;
+ m_nFlag |= XFMARGINS_FLAG_TOP;
+}
+
+inline void XFMargins::SetBottom(double bottom)
+{
+ m_fBottom = bottom;
+ m_nFlag |= XFMARGINS_FLAG_BOTTOM;
+}
+
+inline double XFMargins::GetLeft() const
+{
+ return m_fLeft;
+}
+
+inline double XFMargins::GetTop() const
+{
+ return m_fTop;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfmasterpage.hxx b/lotuswordpro/inc/xfilter/xfmasterpage.hxx
new file mode 100644
index 000000000..dfb10dea0
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfmasterpage.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Master page object which was used to apply a layout to the pages.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFMASTERPAGE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFMASTERPAGE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfheader.hxx>
+#include <xfilter/xffooter.hxx>
+
+class XFFooter;
+class XFHeader;
+class XFMasterPage : public XFStyle
+{
+public:
+ void SetPageMaster(const OUString& pm);
+
+ void SetHeader(rtl::Reference<XFHeader> const & rHeader);
+
+ void SetFooter(rtl::Reference<XFFooter> const & rFooter);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ OUString m_strPageMaster;
+ rtl::Reference<XFHeader> m_xHeader;
+ rtl::Reference<XFFooter> m_xFooter;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfnumberstyle.hxx b/lotuswordpro/inc/xfilter/xfnumberstyle.hxx
new file mode 100644
index 000000000..6b1fd9f0d
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfnumberstyle.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Number style for table cell.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFNUMBERSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFNUMBERSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <rtl/ustring.hxx>
+
+class XFNumberStyle final : public XFStyle
+{
+public:
+ XFNumberStyle();
+
+ void SetDecimalDigits(sal_Int32 decimal);
+
+ void SetGroup();
+
+ void SetColor(const XFColor& color);
+ const XFColor& GetColor() const {return m_aColor;}
+
+ void SetPrefix(const OUString& prefix);
+
+ void SetSurfix(const OUString& surfix);
+
+ void SetNegativeStyle(const OUString& prefix, const OUString& suffix, const XFColor& color);
+
+ void SetNumberType(enumXFNumberType type);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual bool Equal(IXFStyle *pStyle) override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ void ToXml_StartElement(IXFStream *pStrm);
+ void ToXml_EndElement(IXFStream *pStrm);
+ void ToXml_Normal(IXFStream *pStrm);
+ void ToXml_Negative(IXFStream *pStrm);
+ void ToXml_Content(IXFStream *pStrm, bool nagetive);
+
+ enumXFNumberType m_eType;
+ sal_Int32 m_nDecimalDigits;
+ bool m_bGroup;
+ XFColor m_aColor;
+ OUString m_strCurrencySymbol;
+ OUString m_strPrefix;
+ OUString m_strSuffix;
+ bool m_bRedIfNegative;
+ XFColor m_aNegativeColor;
+ OUString m_strNegativePrefix;
+ OUString m_strNegativeSuffix;
+};
+
+inline void XFNumberStyle::SetDecimalDigits(sal_Int32 decimal)
+{
+ m_nDecimalDigits = decimal;
+}
+
+inline void XFNumberStyle::SetNegativeStyle(const OUString& prefix, const OUString& suffix, const XFColor& color)
+{
+ m_bRedIfNegative = true;
+ m_aNegativeColor = color;
+ m_strNegativePrefix = prefix;
+ m_strNegativeSuffix = suffix;
+}
+
+inline void XFNumberStyle::SetGroup()
+{
+ m_bGroup = true;
+}
+
+inline void XFNumberStyle::SetColor(const XFColor& color)
+{
+ m_aColor = color;
+}
+
+inline void XFNumberStyle::SetNumberType(enumXFNumberType type)
+{
+ m_eType = type;
+}
+
+inline void XFNumberStyle::SetPrefix(const OUString& prefix)
+{
+ m_strPrefix = prefix;
+}
+
+inline void XFNumberStyle::SetSurfix(const OUString& surfix)
+{
+ m_strSuffix = surfix;
+}
+
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfnumfmt.hxx b/lotuswordpro/inc/xfilter/xfnumfmt.hxx
new file mode 100644
index 000000000..da4a866ec
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfnumfmt.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Number format. a),A),i),1),(1)
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFNUMFMT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFNUMFMT_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+/**
+ * @brief
+ * Bullet number format.
+ */
+class XFNumFmt
+{
+public:
+ XFNumFmt()
+ {
+ m_nStartValue = 0;
+ }
+
+public:
+ /**********************************************************************
+ * @descr: set the prefix of the number format,that the '(' of output
+ (1 item1
+ (2 item2
+ * @param: prefix
+ *********************************************************************/
+ void SetPrefix(const OUString& prefix)
+ {
+ m_strPrefix = prefix;
+ }
+
+ /**********************************************************************
+ * @descr: set the suffix of the number format,that the ')' of output
+ 1) item1
+ 2) item2
+ * @param: prefix
+ *********************************************************************/
+ void SetSuffix(const OUString& suffix)
+ {
+ m_strSuffix = suffix;
+ }
+
+ /**********************************************************************
+ * @descr: set the display value. ie. if you set format to '1',then
+ the output would be:
+ 1 item1
+ 2 item2
+ or if you set the format to 'a', then the output would be:
+ a item1
+ b item2
+ some special, if you set the format to a sequence,ie. "一,二,三,..."
+ the output would be:
+ 一 item1
+ 二 item2
+ 三 item3
+
+ Of course, for unordered-list, you can also set the format to
+ be a bullet char,ie:
+ '','','','','',
+ * @param: prefix
+ *********************************************************************/
+ void SetFormat(const OUString& format)
+ {
+ m_strFormat = format;
+ }
+
+ void SetStartValue(sal_Int16 start)
+ {
+ m_nStartValue = start;
+ }
+
+ void ToXml(IXFStream *pStrm)
+ {
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !m_strPrefix.isEmpty() )
+ pAttrList->AddAttribute( "style:num-prefix", m_strPrefix );
+ if( !m_strSuffix.isEmpty() )
+ pAttrList->AddAttribute( "style:num-suffix", m_strSuffix );
+ pAttrList->AddAttribute( "style:num-format", m_strFormat );
+ if( m_nStartValue != 0 )
+ pAttrList->AddAttribute( "text:start-value", OUString::number(static_cast<sal_Int32>(m_nStartValue)) );
+ }
+private:
+ OUString m_strPrefix;
+ OUString m_strSuffix;
+ OUString m_strFormat;
+ sal_Int16 m_nStartValue;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfofficemeta.hxx b/lotuswordpro/inc/xfilter/xfofficemeta.hxx
new file mode 100644
index 000000000..a183ab793
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfofficemeta.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Meta info for the full document.
+ * You can see this by click: File->Properties.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFOFFICEMETA_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFOFFICEMETA_HXX
+
+#include <xfilter/ixfstream.hxx>
+
+class XFOfficeMeta final
+{
+public:
+ XFOfficeMeta(){}
+
+ void SetCreator(const OUString& creator);
+ void SetDescription(const OUString& dsr);
+ void SetKeywords(const OUString& keywords);
+ void SetCreationTime(const OUString& crtime);
+ void SetLastTime(const OUString& lstime);
+ void SetEditTime(const OUString& edtime);
+
+ void ToXml(IXFStream *pStream);
+private:
+ OUString m_strGenerator;
+ OUString m_strTitle;
+ OUString m_strCreator;
+ OUString m_strDsr;
+ OUString m_strKeywords;
+ OUString m_strCrtime;
+ OUString m_strLstime;
+ OUString m_strEdtime;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfpadding.hxx b/lotuswordpro/inc/xfilter/xfpadding.hxx
new file mode 100644
index 000000000..69e30723b
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfpadding.hxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Padding for paragraph.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPADDING_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPADDING_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+#define XFPADDING_FLAG_LEFT 0X00000001
+#define XFPADDING_FLAG_RIGHT 0X00000002
+#define XFPADDING_FLAG_TOP 0X00000004
+#define XFPADDING_FLAG_BOTTOM 0X00000008
+
+/**
+ * @brief
+ * Padings for paragraph,frame,...
+ */
+class XFPadding
+{
+public:
+ XFPadding();
+
+public:
+ /**
+ * @descr Reset all values.
+ */
+ void Reset();
+
+ /**
+ * @descr Set padding left.
+ */
+ void SetLeft(double left);
+
+ /**
+ * @descr Set padding right.
+ */
+ void SetRight(double right);
+
+ /**
+ * @descr Set padding top.
+ */
+ void SetTop(double top);
+
+ /**
+ * @descr Set padding bottom.
+ */
+ void SetBottom(double bottom);
+
+ /**
+ * @descr Output padding properties.
+ */
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFPadding const & p1, XFPadding const & p2);
+ friend bool operator!=(XFPadding const & p1, XFPadding const & p2);
+private:
+ int m_nFlag;
+ double m_fLeft;
+ double m_fRight;
+ double m_fTop;
+ double m_fBottom;
+};
+
+inline XFPadding::XFPadding()
+{
+ Reset();
+}
+
+inline void XFPadding::Reset()
+{
+ m_nFlag = 0;
+ m_fLeft = 0;
+ m_fRight = 0;
+ m_fTop = 0;
+ m_fBottom = 0;
+}
+
+inline void XFPadding::SetLeft(double left)
+{
+ m_fLeft = left;
+ m_nFlag |= XFPADDING_FLAG_LEFT;
+}
+
+inline void XFPadding::SetRight(double right)
+{
+ m_fRight = right;
+ m_nFlag |= XFPADDING_FLAG_RIGHT;
+}
+
+inline void XFPadding::SetTop(double top)
+{
+ m_fTop = top;
+ m_nFlag |= XFPADDING_FLAG_TOP;
+}
+
+inline void XFPadding::SetBottom(double bottom)
+{
+ m_fBottom = bottom;
+ m_nFlag |= XFPADDING_FLAG_BOTTOM;
+}
+
+inline void XFPadding::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( (m_fLeft == m_fRight) && (m_fLeft == m_fTop) && (m_fLeft== m_fBottom ) && m_nFlag == 0x00000015 )
+ {
+ pAttrList->AddAttribute( "fo:padding", OUString::number(m_fLeft) + "cm" );
+ return;
+ }
+ //margin left:
+ if( m_nFlag&XFPADDING_FLAG_LEFT )
+ {
+ pAttrList->AddAttribute( "fo:padding-left", OUString::number(m_fLeft) + "cm" );
+ }
+ //margin right:
+ if( m_nFlag&XFPADDING_FLAG_RIGHT )
+ {
+ pAttrList->AddAttribute("fo:padding-right", OUString::number(m_fRight) + "cm" );
+ }
+ //margin top:
+ if( m_nFlag&XFPADDING_FLAG_TOP )
+ {
+ pAttrList->AddAttribute("fo:padding-top", OUString::number(m_fTop) + "cm" );
+ }
+ //margin bottom:
+ if( m_nFlag&XFPADDING_FLAG_BOTTOM )
+ {
+ pAttrList->AddAttribute("fo:padding-bottom", OUString::number(m_fBottom) + "cm" );
+ }
+}
+
+inline bool operator==(XFPadding const & p1, XFPadding const & p2)
+{
+ return (
+ (p1.m_nFlag == p2.m_nFlag) &&
+ (p1.m_fLeft == p2.m_fLeft) &&
+ (p1.m_fRight == p2.m_fRight) &&
+ (p1.m_fTop == p2.m_fTop) &&
+ (p1.m_fBottom == p2.m_fBottom)
+ );
+}
+
+inline bool operator!=(XFPadding const & p1, XFPadding const & p2)
+{
+ return !(p1==p2);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfpagecount.hxx b/lotuswordpro/inc/xfilter/xfpagecount.hxx
new file mode 100644
index 000000000..00f9ed708
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfpagecount.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Page number field.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPAGECOUNT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPAGECOUNT_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+
+/**
+ * @brief
+ * Page count field.
+ */
+class XFPageCount : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+inline void XFPageCount::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pStrm->StartElement( "text:page-count" );
+ pStrm->EndElement( "text:page-count" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfpagemaster.hxx b/lotuswordpro/inc/xfilter/xfpagemaster.hxx
new file mode 100644
index 000000000..3864cfdda
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfpagemaster.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Page master used bye XFMasterPage.
+ * It is the real object to define header and footer of pages.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPAGEMASTER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPAGEMASTER_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <memory>
+
+class XFBorders;
+class XFShadow;
+class XFColumns;
+class XFHeaderStyle;
+class XFFooterStyle;
+class XFBGImage;
+
+class XFPageMaster : public XFStyle
+{
+public:
+ XFPageMaster();
+
+ virtual ~XFPageMaster() override;
+
+public:
+ void SetPageWidth(double width);
+
+ void SetPageHeight(double height);
+
+ void SetMargins(double left, double right, double top, double bottom);
+
+ void SetPageUsage(enumXFPageUsage usage);
+
+ void SetBorders(std::unique_ptr<XFBorders> pBorders);
+
+ void SetShadow(XFShadow *pShadow);
+
+ void SetBackColor(XFColor color);
+
+ void SetBackImage(std::unique_ptr<XFBGImage>& rImage);
+
+ void SetColumns(XFColumns *pColumns);
+
+ void SetHeaderStyle(XFHeaderStyle *pHeaderStyle);
+
+ void SetFooterStyle(XFFooterStyle *pFooterStyle);
+
+ void SetTextDir(enumXFTextDir dir);
+
+ void SetFootNoteSeparator(enumXFAlignType align,
+ double width,
+ sal_Int32 lengthPercent,
+ double spaceAbove,
+ double spaceBelow,
+ XFColor color
+ );
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStream) override;
+
+private:
+ double m_fPageWidth;
+ double m_fPageHeight;
+
+ XFMargins m_aMargin;
+
+ enumXFPageUsage m_eUsage;
+ enumXFTextDir m_eTextDir;
+
+ std::unique_ptr<XFBorders> m_pBorders;
+ std::unique_ptr<XFShadow> m_pShadow;
+ XFColor m_aBackColor;
+ std::unique_ptr<XFColumns> m_pColumns;
+ std::unique_ptr<XFBGImage> m_pBGImage;
+
+ std::unique_ptr<XFHeaderStyle> m_pHeaderStyle;
+ std::unique_ptr<XFFooterStyle> m_pFooterStyle;
+ //separator:
+ enumXFAlignType m_eSepAlign;
+ double m_fSepWidth;
+ XFColor m_aSepColor;
+ double m_fSepSpaceAbove;
+ double m_fSepSpaceBelow;
+ sal_Int32 m_nSepLengthPercent;
+
+};
+
+inline void XFPageMaster::SetPageUsage(enumXFPageUsage usage)
+{
+ m_eUsage = usage;
+}
+
+inline void XFPageMaster::SetTextDir(enumXFTextDir dir)
+{
+ m_eTextDir = dir;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfpagenumber.hxx b/lotuswordpro/inc/xfilter/xfpagenumber.hxx
new file mode 100644
index 000000000..aa63530a1
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfpagenumber.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Page number field.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPAGENUMBER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPAGENUMBER_HXX
+
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/xfnumfmt.hxx>
+
+/**
+ * @brief
+ * Page number field.
+ */
+class XFPageNumber : public XFContent
+{
+public:
+ void SetNumFmt(const OUString& fmt);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ XFNumFmt m_aNumFmt;
+};
+
+inline void XFPageNumber::SetNumFmt(const OUString& fmt)
+{
+ m_aNumFmt.SetFormat(fmt);
+}
+
+inline void XFPageNumber::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ m_aNumFmt.ToXml(pStrm);
+ pAttrList->AddAttribute( "text:select-page", "current" );
+ pStrm->StartElement( "text:page-number" );
+ pStrm->EndElement( "text:page-number" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfparagraph.hxx b/lotuswordpro/inc/xfilter/xfparagraph.hxx
new file mode 100644
index 000000000..e53399272
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfparagraph.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Paragraph object of OOo, it will output <text:p >...</text:p> element.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPARAGRAPH_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPARAGRAPH_HXX
+
+#include <xfilter/xfcontentcontainer.hxx>
+
+class IXFStream;
+
+/**
+ * @brief
+ * Paragraph object for SODC.
+ * You can call Add() to add text span or drawing objects to XFParagraph.
+ */
+class XFParagraph : public XFContentContainer
+{
+public:
+ XFParagraph();
+
+ virtual ~XFParagraph() override;
+
+public:
+ bool HasContents() const;
+
+ virtual enumXFContent GetContentType() override;
+
+ virtual void ToXml(IXFStream* pStrm) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfparastyle.hxx b/lotuswordpro/inc/xfilter/xfparastyle.hxx
new file mode 100644
index 000000000..339f6a3c7
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfparastyle.hxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Styles for paragraph.
+ * Styles for paragraph may include many style,include font,indent,margin,
+ * shadow,line height,and so on.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPARASTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPARASTYLE_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include <xfilter/xffont.hxx>
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xfbreaks.hxx>
+#include <xfilter/xfpadding.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <xfilter/xfdropcap.hxx>
+#include <xfilter/xfstylecont.hxx>
+#include <xfilter/xflineheight.hxx>
+#include <memory>
+
+#define XFPARA_FLAG_FONT 0X00000001
+#define XFPARA_FLAG_DROPCAP 0X00000002
+#define XFPARA_FLAG_BACKCOLOR 0X00000004
+
+class XFBorders;
+class XFBGImage;
+
+/**
+ * @brief
+ * Style object for aragraph.
+ */
+class XFParaStyle : public XFStyle
+{
+public:
+ XFParaStyle();
+
+ XFParaStyle(const XFParaStyle& other);
+
+ XFParaStyle& operator=(const XFParaStyle& other);
+
+ virtual ~XFParaStyle() override;
+
+public:
+ /**
+ * @descr Set layout for the paragraph. When such property was set, this paragraph will
+ * start at a new page.
+ */
+ void SetMasterPage(const OUString& master);
+
+ const OUString& GetMasterPage() const;
+
+ /**
+ * @descr set the paragraph default font.
+ * @param font object to be set. Font object is deleted by font-factory, so
+ * don't delete it in the destructure function of para style.
+ */
+ void SetFont(rtl::Reference<XFFont> const & font);
+
+ /**
+ * @descr get the font object.
+ */
+ const rtl::Reference<XFFont>& GetFont() const { return m_pFont; }
+
+ /**
+ * @descr Set the indent of the paragraph. This is the indent for
+ the first line.
+ * @param indent value of the first-line indent.
+ */
+ void SetIndent(double indent );
+
+ /**
+ * @descr Set the padding of the paragraph. This is the distance
+ between the border and the top of the text.
+ * @param indent value of the padding.
+ */
+ void SetPadding(double left, double right, double top, double bottom);
+
+ /**
+ * @descr Set the Margins of the paragraph.
+ * @param -1: don't change.
+ other: set value.
+ */
+ void SetMargins(double left, double right,double top=-1, double bottom=-1);
+
+ /**
+ * @descr Set alignment property of the paragraph.
+ * @param eAlign alignment type,left,right,center or justify.
+ */
+ void SetAlignType(enumXFAlignType eAlign);
+
+ /**
+ * @descr Set the shadow of the paragraph. There are 4 positions, you
+ can find it in the definition of enumShadowPos.
+ * @param pos
+ * @param offset the distance between the paragraph border and the shadow.
+ * @param color color to fill the shadow.
+ */
+ void SetShadow(enumXFShadowPos pos, double offset, XFColor const & color);
+
+ /**
+ * @descr The borders is complex, so you have to create one before use.
+ Very few paragraphs will already have borders property, this way
+ we can save much memory.
+ * @param pBorders borders of the paragraph, please reference the XFBorders.
+ */
+ void SetBorders(XFBorders *pBorders);
+
+ /**
+ * @descr Set drop caption of the paragraph.
+ * @param nLength number of chars to be dropped.
+ * @param nLines line of which the dropped chars will occupy.
+ */
+ void SetDropCap(sal_Int16 nLength, sal_Int16 nLines, double fDistance = 0);
+
+ /**
+ * @descr Set line height of the paragraph.
+ * @param type type of line height,fixed,space,percent or cm.
+ * @param value value of the line height
+ */
+ void SetLineHeight(enumLHType type, double value);
+
+ /**
+ * @descr Set background color of the paragraph.
+ * @param color value of the back color.
+ */
+ void SetBackColor(XFColor const & color);
+
+ /**
+ * @descr Set background image of the paragraph.
+ * @param image the background image to set.
+ */
+ void SetBackImage(std::unique_ptr<XFBGImage>& rImage);
+
+ /**
+ * descr You can only set one break property for every para style object.
+ */
+ void SetBreaks(enumXFBreaks breaks);
+
+ /**
+ * @descr Add a tab style.
+ */
+ void AddTabStyle(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter);
+
+ /**
+ * @descr for para style copy operator, sometimes you may need to override tab styles.
+ */
+ void ClearTabStyles();
+
+ XFMargins& GetMargins(){return m_aMargin;}
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual bool Equal(IXFStyle *pStyle) override;
+
+ virtual void ToXml(IXFStream *strm) override;
+
+ void SetNumberRight(bool bFlag){m_bNumberRight = bFlag;}
+ bool GetNumberRight() const {return m_bNumberRight;}
+
+protected:
+ OUString m_strMasterPage;
+ enumXFAlignType m_eAlignType;
+
+ double m_fTextIndent;
+ XFColor m_aBackColor;
+ XFMargins m_aMargin;
+ XFPadding m_aPadding;
+ XFStyleContainer m_aTabs;
+ rtl::Reference<XFFont> m_pFont;
+ XFShadow m_aShadow;
+ std::unique_ptr<XFBorders> m_pBorders;
+ std::unique_ptr<XFBGImage> m_pBGImage;
+ XFDropcap m_aDropcap;
+ XFLineHeight m_aLineHeight;
+ XFBreaks m_aBreaks;
+
+ sal_uInt32 m_nFlag;
+ bool m_bNumberRight;
+};
+
+inline void XFParaStyle::SetMasterPage(const OUString& master)
+{
+ m_strMasterPage = master;
+}
+
+inline void XFParaStyle::SetBreaks(enumXFBreaks breaks)
+{
+ m_aBreaks.SetBreakType(breaks);
+}
+
+inline void XFParaStyle::SetPadding(double left, double right, double top, double bottom)
+{
+ m_aPadding.SetLeft(left);
+ if( right == -1 )
+ m_aPadding.SetRight(left);
+ else
+ m_aPadding.SetRight(right);
+ if( top == -1 )
+ m_aPadding.SetTop(left);
+ else
+ m_aPadding.SetTop(top);
+ if( bottom == -1 )
+ m_aPadding.SetBottom(left);
+ else
+ m_aPadding.SetBottom(bottom);
+}
+
+inline void XFParaStyle::SetAlignType(enumXFAlignType eAlign)
+{
+ m_eAlignType = eAlign;
+}
+
+inline void XFParaStyle::ClearTabStyles()
+{
+ m_aTabs.Reset();
+}
+
+inline const OUString& XFParaStyle::GetMasterPage() const
+{
+ return m_strMasterPage;
+}
+
+
+class XFDefaultParaStyle : public XFStyle
+{
+public:
+ XFDefaultParaStyle();
+ void SetTabDistance(double len);
+ enumXFStyle GetStyleFamily() override;
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+ double m_fTabDistance;
+};
+
+inline void XFDefaultParaStyle::SetTabDistance(double len)
+{
+ m_fTabDistance = len;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfplaceholder.hxx b/lotuswordpro/inc/xfilter/xfplaceholder.hxx
new file mode 100644
index 000000000..1e730a8fe
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfplaceholder.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * place holder object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPLACEHOLDER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPLACEHOLDER_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+
+/**
+ * @brief
+ * Index entry object.
+ */
+class XFHolderStart : public XFContent
+{
+public:
+ XFHolderStart();
+ virtual ~XFHolderStart() override;
+ void SetType(const OUString& sType);
+ void SetDesc(const OUString& sDesc);
+ void SetPrompt(const OUString& sText);
+ void ToXml(IXFStream *pStrm) override;
+private:
+ OUString m_strType;
+ OUString m_strDesc;
+ OUString m_strText;
+};
+
+XFHolderStart::XFHolderStart()
+{
+}
+
+XFHolderStart::~XFHolderStart()
+{
+}
+
+inline void XFHolderStart::SetType(const OUString& sType)
+{
+ m_strType = sType;
+}
+
+inline void XFHolderStart::SetDesc(const OUString& sDesc)
+{
+ m_strDesc = sDesc;
+}
+
+inline void XFHolderStart::SetPrompt(const OUString& sText)
+{
+ m_strText = sText;
+}
+
+inline void XFHolderStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:placeholder-type",m_strType);
+ if (!m_strDesc.isEmpty())
+ pAttrList->AddAttribute( "text:description", m_strDesc);
+ pStrm->StartElement( "text:placeholder" );
+ if( !m_strText.isEmpty())
+ pStrm->Characters(m_strText);
+}
+
+class XFHolderEnd : public XFContent
+{
+public:
+ XFHolderEnd();
+ virtual ~XFHolderEnd() override;
+ void ToXml(IXFStream *pStrm) override;
+};
+
+XFHolderEnd::XFHolderEnd()
+{
+}
+
+XFHolderEnd::~XFHolderEnd()
+{
+}
+
+inline void XFHolderEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:placeholder" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfpoint.hxx b/lotuswordpro/inc/xfilter/xfpoint.hxx
new file mode 100644
index 000000000..42ac4474f
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfpoint.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Represent a point.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPOINT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFPOINT_HXX
+
+class XFPoint
+{
+public:
+ XFPoint()
+ {
+ m_fX = m_fY = 0;
+ }
+
+ XFPoint(double x, double y)
+ {
+ m_fX = x;
+ m_fY = y;
+ }
+
+public:
+ void SetX(double x)
+ {
+ m_fX = x;
+ }
+
+ void SetY(double y)
+ {
+ m_fY = y;
+ }
+
+ double GetX() const
+ {
+ return m_fX;
+ }
+
+ double GetY() const
+ {
+ return m_fY;
+ }
+
+private:
+ double m_fX;
+ double m_fY;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfrect.hxx b/lotuswordpro/inc/xfilter/xfrect.hxx
new file mode 100644
index 000000000..ed450cfe4
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfrect.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Rect object
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFRECT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFRECT_HXX
+
+#include <xfilter/xfpoint.hxx>
+
+class XFRect
+{
+public:
+ XFRect()
+ {
+ m_fWidth = m_fHeight = 0;
+ }
+
+ XFRect(double x, double y, double width, double height):m_aPoint(x,y)
+ {
+ m_fWidth = width;
+ m_fHeight = height;
+ }
+
+public:
+ void SetX(double x)
+ {
+ m_aPoint.SetX(x);
+ }
+
+ double GetX() const
+ {
+ return m_aPoint.GetX();
+ }
+
+ void SetY(double y)
+ {
+ m_aPoint.SetY(y);
+ }
+
+ double GetY() const
+ {
+ return m_aPoint.GetY();
+ }
+
+ void SetWidth(double width)
+ {
+ m_fWidth = width;
+ }
+
+ double GetWidth() const
+ {
+ return m_fWidth;
+ }
+
+ void SetHeight(double height)
+ {
+ m_fHeight = height;
+ }
+
+ double GetHeight() const
+ {
+ return m_fHeight;
+ }
+
+ void SetStartPoint(const XFPoint& pt)
+ {
+ m_aPoint = pt;
+ }
+
+ void SetSize(double width, double height)
+ {
+ m_fWidth = width;
+ m_fHeight = height;
+ }
+
+private:
+ XFPoint m_aPoint;
+ double m_fWidth;
+ double m_fHeight;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfrow.hxx b/lotuswordpro/inc/xfilter/xfrow.hxx
new file mode 100644
index 000000000..009bdad95
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfrow.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table row object. A table is consist by rows.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFROW_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFROW_HXX
+
+#include <xfilter/xfcell.hxx>
+#include <xfilter/xfcontent.hxx>
+#include <rtl/ref.hxx>
+#include <map>
+
+class XFCell;
+class XFTable;
+class XFRow : public XFContent
+{
+public:
+ XFRow();
+
+ virtual ~XFRow() override;
+
+public:
+ void AddCell(rtl::Reference<XFCell> const & rCell);
+
+ void SetRepeated(sal_Int32 repeat);
+
+ void SetRow(sal_Int32 row);
+
+ void SetOwnerTable(XFTable *pTable);
+
+ sal_Int32 GetRow() const;
+
+ sal_Int32 GetCellCount() const;
+
+ XFCell* GetCell(sal_Int32 col) const;
+
+ XFTable* GetOwnerTable();
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ void RemoveCell(sal_Int32 cell);
+
+private:
+ XFTable *m_pOwnerTable;
+ std::map<sal_Int32, rtl::Reference<XFCell>> m_aCells;
+ sal_Int32 m_nRepeat;
+ sal_Int32 m_nRow;
+};
+
+inline void XFRow::SetRepeated(sal_Int32 repeat)
+{
+ m_nRepeat = repeat;
+}
+
+inline void XFRow::SetRow(sal_Int32 row)
+{
+ m_nRow = row;
+}
+
+inline void XFRow::SetOwnerTable(XFTable *pTable)
+{
+ m_pOwnerTable = pTable;
+}
+
+inline sal_Int32 XFRow::GetRow() const
+{
+ return m_nRow;
+}
+
+inline XFTable* XFRow::GetOwnerTable()
+{
+ return m_pOwnerTable;
+}
+
+inline void XFRow::RemoveCell(sal_Int32 cell)
+{
+ m_aCells.erase(cell);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfrowstyle.hxx b/lotuswordpro/inc/xfilter/xfrowstyle.hxx
new file mode 100644
index 000000000..8ca8d1223
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfrowstyle.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table row style, ie. table row height.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFROWSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFROWSTYLE_HXX
+
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+
+class XFBGImage;
+class XFRowStyle : public XFStyle
+{
+public:
+ XFRowStyle();
+
+public:
+ void SetRowHeight(double height);
+
+ double GetRowHeight() const;
+
+ void SetMinRowHeight(double height);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ double m_fHeight;
+ double m_fMinHeight;
+ XFColor m_aBackColor;
+};
+
+inline void XFRowStyle::SetRowHeight(double height)
+{
+ m_fHeight = height;
+}
+
+inline void XFRowStyle::SetMinRowHeight(double height)
+{
+ m_fMinHeight = height;
+}
+
+inline double XFRowStyle::GetRowHeight() const
+{
+ if (m_fMinHeight > FLOAT_MIN)
+ {
+ return m_fMinHeight;
+ }
+
+ else if (m_fHeight > FLOAT_MIN)
+ {
+ return m_fHeight;
+ }
+ return 0;
+}
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfruby.hxx b/lotuswordpro/inc/xfilter/xfruby.hxx
new file mode 100644
index 000000000..d481d4758
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfruby.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * ruby text.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFRUBY_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFRUBY_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+
+class XFRubyStart : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+class XFRubyEnd : public XFContent
+{
+public:
+ void SetText(const OUString& sText);
+ virtual void ToXml(IXFStream *pStrm) override;
+private:
+ OUString m_strText;
+};
+
+void XFRubyStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty())
+ pAttrList->AddAttribute( "text:style-name", GetStyleName());
+ pStrm->StartElement( "text:ruby" );
+ pAttrList->Clear();
+ pStrm->StartElement( "text:ruby-base" );
+}
+
+void XFRubyEnd::SetText(const OUString& sText)
+{
+ m_strText = sText;
+}
+
+void XFRubyEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:ruby-base" );
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty())
+ pAttrList->AddAttribute( "text:style-name", GetStyleName());
+ pStrm->StartElement( "text:ruby-text" );
+ if( !m_strText.isEmpty() )
+ pStrm->Characters(m_strText);
+ pStrm->EndElement( "text:ruby-text" );
+ pStrm->EndElement( "text:ruby" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfrubystyle.hxx b/lotuswordpro/inc/xfilter/xfrubystyle.hxx
new file mode 100644
index 000000000..184e7126a
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfrubystyle.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * ruby style.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFRUBYSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFRUBYSTYLE_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfdefs.hxx>
+
+class XFRubyStyle : public XFStyle
+{
+public:
+ XFRubyStyle()
+ : m_ePos(enumXFRubyLeft)
+ , m_eAlign(enumXFRubyLeft)
+ {
+ }
+ virtual void ToXml(IXFStream *strm) override;
+ void SetPosition(enumXFRubyPosition ePosition);
+ void SetAlignment(enumXFRubyPosition eAlignment);
+ enumXFStyle GetStyleFamily() override;
+
+private:
+ enumXFRubyPosition m_ePos;
+ enumXFRubyPosition m_eAlign;
+};
+
+void XFRubyStyle::SetPosition(enumXFRubyPosition ePosition)
+{
+ m_ePos = ePosition;
+}
+void XFRubyStyle::SetAlignment(enumXFRubyPosition eAlignment)
+{
+ m_eAlign = eAlignment;
+}
+enumXFStyle XFRubyStyle::GetStyleFamily()
+{
+ return enumXFStyleRuby;
+}
+void XFRubyStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ OUString style = GetStyleName();
+
+ pAttrList->Clear();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute("style:name", GetStyleName());
+ pAttrList->AddAttribute("style:family", "ruby");
+ pStrm->StartElement("style:style");
+
+ pAttrList->Clear();
+
+ OUString sPos;
+ if (m_eAlign == enumXFRubyLeft)
+ {
+ sPos ="left";
+ }
+ else if(m_eAlign == enumXFRubyRight)
+ {
+ sPos = "right";
+ }
+ else if(m_eAlign == enumXFRubyCenter)
+ {
+ sPos = "center";
+ }
+ if (!sPos.isEmpty())
+ pAttrList->AddAttribute("style:ruby-align", sPos);
+
+ OUString sAlign;
+ if (m_ePos == enumXFRubyTop)
+ {
+ sAlign = "above";
+ }
+ else if(m_ePos == enumXFRubyBottom)
+ {
+ sAlign = "below";
+ }
+ if (!sAlign.isEmpty())
+ pAttrList->AddAttribute("style:ruby-position", sAlign);
+
+ pStrm->StartElement("style:properties");
+ pStrm->EndElement("style:properties");
+ pStrm->EndElement("style:style");
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfsaxstream.hxx b/lotuswordpro/inc/xfilter/xfsaxstream.hxx
new file mode 100644
index 000000000..e86f817ab
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfsaxstream.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tool for sax writer.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSAXSTREAM_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSAXSTREAM_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <memory>
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+class XFSaxAttrList;
+class IXFAttrList;
+
+/**
+ * @brief
+ * Sax stream object, XDocumentHandler wrapper.
+ */
+class XFSaxStream : public IXFStream
+{
+public:
+ explicit XFSaxStream(css::uno::Reference<css::xml::sax::XDocumentHandler> const & xHandler);
+
+ virtual ~XFSaxStream() override;
+
+public:
+ /**
+ * @descr Start document callback.
+ */
+ virtual void StartDocument() override;
+
+ /**
+ * @descr End document callback.
+ */
+ virtual void EndDocument() override;
+
+ /**
+ * @descr Start output element.
+ */
+ virtual void StartElement(const OUString& oustr) override;
+
+ /**
+ * @descr End output element.
+ */
+ virtual void EndElement(const OUString& oustr) override;
+
+ /**
+ * @descr Output Character section.
+ */
+ virtual void Characters(const OUString& oustr) override;
+
+ /**
+ * @descr Get the attribute list interface.
+ */
+ virtual IXFAttrList* GetAttrList() override;
+
+private:
+ css::uno::Reference<css::xml::sax::XDocumentHandler> m_aHandler;
+ std::unique_ptr<XFSaxAttrList> m_pAttrList;
+};
+
+#endif //XFSAXSTREAM_INC
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfsection.hxx b/lotuswordpro/inc/xfilter/xfsection.hxx
new file mode 100644
index 000000000..a855c6e89
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfsection.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Section object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSECTION_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSECTION_HXX
+
+#include <xfilter/xfcontentcontainer.hxx>
+
+/**
+ * @brief
+ * Section object.
+ */
+class XFSection : public XFContentContainer
+{
+public:
+ XFSection();
+
+ virtual ~XFSection() override;
+
+ /**
+ * @descr Output section object.
+ */
+ virtual void ToXml(IXFStream* pStrm) override;
+
+private:
+ OUString m_strSectionName;
+ OUString m_strSourceLink;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfsectionstyle.hxx b/lotuswordpro/inc/xfilter/xfsectionstyle.hxx
new file mode 100644
index 000000000..f112ab33f
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfsectionstyle.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Section style,whose family is "section"
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSECTIONSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSECTIONSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <memory>
+
+class XFColumns;
+/*
+ * @descr
+ * Section style, include background color,background image, columns and margins.
+ */
+class XFSectionStyle : public XFStyle
+{
+public:
+ XFSectionStyle();
+
+ virtual ~XFSectionStyle() override;
+
+public:
+ void SetMarginLeft(double left);
+
+ void SetMarginRight(double right);
+
+ void SetColumns(XFColumns *pColumns);
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ double m_fMarginLeft;
+ double m_fMarginRight;
+ XFColor m_aBackColor;
+ std::unique_ptr<XFColumns> m_pColumns;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfshadow.hxx b/lotuswordpro/inc/xfilter/xfshadow.hxx
new file mode 100644
index 000000000..19b74c7fb
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfshadow.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Shadow object,now only used by paragraph object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSHADOW_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSHADOW_HXX
+
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfdefs.hxx>
+
+/**
+ * @brief
+ * Shadow object.
+ */
+class XFShadow
+{
+public:
+ XFShadow();
+
+public:
+ /**
+ * @descr set shadow position. You can refer to enumXFShadowPos to get all possible positions.
+ */
+ void SetPosition(enumXFShadowPos pos);
+
+ /**
+ * @descr return shadow position.
+ */
+ enumXFShadowPos GetPosition() const;
+
+ /**
+ * @descr Set shadow offset from owner object.
+ */
+ void SetOffset(double offset);
+
+ /**
+ * @descr return shadow offset.
+ */
+ double GetOffset() const;
+
+ /**
+ * @descr Set shadow color.
+ */
+ void SetColor(const XFColor& color);
+
+ /**
+ * @descr return shadow color.
+ */
+ const XFColor& GetColor() const;
+
+ OUString ToString();
+
+ void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFShadow const & s1, XFShadow const & s2);
+ friend bool operator!=(XFShadow const & s1, XFShadow const & s2);
+private:
+ enumXFShadowPos m_ePosition;
+ double m_fOffset;
+ XFColor m_aColor;
+};
+
+inline void XFShadow::SetPosition(enumXFShadowPos pos)
+{
+ m_ePosition = pos;
+}
+
+inline enumXFShadowPos XFShadow::GetPosition() const
+{
+ return m_ePosition;
+}
+
+inline void XFShadow::SetOffset(double offset)
+{
+ m_fOffset = offset;
+}
+
+inline double XFShadow::GetOffset() const
+{
+ return m_fOffset;
+}
+
+inline void XFShadow::SetColor(const XFColor& color)
+{
+ m_aColor = color;
+}
+
+inline const XFColor& XFShadow::GetColor() const
+{
+ return m_aColor;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfstyle.hxx b/lotuswordpro/inc/xfilter/xfstyle.hxx
new file mode 100644
index 000000000..493f000c6
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfstyle.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Base style object .
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSTYLE_HXX
+
+#include <xfilter/ixfstyle.hxx>
+
+/**
+ * @brief
+ * implements ixfstyle interface. This is the base class for all concentrate style.
+ */
+class XFStyle : public IXFStyle
+{
+public:
+ XFStyle();
+
+ virtual ~XFStyle() override;
+
+ XFStyle(XFStyle const &) = default;
+ XFStyle(XFStyle &&) = default;
+ XFStyle & operator =(XFStyle const &) = default;
+ XFStyle & operator =(XFStyle &&) = default;
+
+public:
+ /**
+ * @descr get style name.
+ */
+ virtual OUString GetStyleName() override;
+
+ /**
+ * @descr set style name.
+ */
+ virtual void SetStyleName(const OUString& styleName) override;
+
+ /**
+ * @descr set parent style name.
+ */
+ virtual OUString GetParentStyleName() override;
+
+ /**
+ * @descr return parent style name.
+ */
+ virtual void SetParentStyleName(const OUString& styleName) override;
+
+ /**
+ * @descr get style family.
+ */
+ virtual enumXFStyle GetStyleFamily() override;
+
+ /**
+ * @descr decide whether two style are equal.
+ */
+ virtual bool Equal(IXFStyle *pStyle) override;
+
+protected:
+ OUString m_strStyleName;
+ OUString m_strParentStyleName;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfstylecont.hxx b/lotuswordpro/inc/xfilter/xfstylecont.hxx
new file mode 100644
index 000000000..5418f9a88
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfstylecont.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style container,which response for special style,ie. text style.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSTYLECONT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSTYLECONT_HXX
+
+#include <xfilter/ixfstyle.hxx>
+#include <vector>
+#include <memory>
+
+class IXFStyle;
+
+struct IXFStyleRet
+{
+ IXFStyle* m_pStyle;
+ bool m_bOrigDeleted;
+ IXFStyleRet()
+ : m_pStyle(nullptr)
+ , m_bOrigDeleted(false)
+ {
+ }
+};
+
+/**
+ * @descr container object for styles.
+ * All styles can be placed into a style container.
+ */
+class XFStyleContainer
+{
+public:
+ XFStyleContainer(){}
+
+ explicit XFStyleContainer(const OUString& strStyleNamePrefix);
+
+ XFStyleContainer(const XFStyleContainer& other) = delete;
+
+ XFStyleContainer& operator=(const XFStyleContainer& other) = delete;
+
+ virtual ~XFStyleContainer();
+
+public:
+ /**
+ * @descr Add style to container.
+ * If the same style has exist, then pStyle will be deleted, and the same style will be return.
+ */
+ IXFStyleRet AddStyle(std::unique_ptr<IXFStyle> pStyle);
+
+ /**
+ * @descr Find the same style.
+ */
+ IXFStyle* FindSameStyle(IXFStyle *pStyle);
+
+ /**
+ * @descr get style by name.
+ */
+ IXFStyle* FindStyle(const OUString& name);
+
+ /**
+ * @descr clear container.
+ */
+ void Reset();
+
+ /**
+ * @descr get count of styles in the container.
+ */
+ size_t GetCount() const;
+
+ /**
+ * @descr get style by index.
+ */
+ const IXFStyle* Item(size_t index) const;
+
+ /**
+ * @descr Output all style.
+ */
+ virtual void ToXml(IXFStream *pStrm);
+
+ friend bool operator==(XFStyleContainer& b1, XFStyleContainer& b2);
+ friend bool operator!=(XFStyleContainer& b1, XFStyleContainer& b2);
+private:
+ static void ManageStyleFont(IXFStyle *pStyle);
+private:
+ std::vector<std::unique_ptr<IXFStyle>> m_aStyles;
+ OUString m_strStyleNamePrefix;
+};
+
+inline size_t XFStyleContainer::GetCount() const
+{
+ return m_aStyles.size();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfstylemanager.hxx b/lotuswordpro/inc/xfilter/xfstylemanager.hxx
new file mode 100644
index 000000000..d2de7b575
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfstylemanager.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style manager for the filter.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSTYLEMANAGER_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFSTYLEMANAGER_HXX
+
+#include <xfilter/xffontdecl.hxx>
+#include <xfilter/xfstylecont.hxx>
+#include <xfilter/xfconfigmanager.hxx>
+#include <vector>
+
+class IXFStream;
+class IXFStyle;
+class XFParaStyle;
+class XFTextStyle;
+class XFLineNumberConfig;
+class XFFootnoteConfig;
+class XFEndnoteConfig;
+
+/**
+ * @brief
+ * Style manager for the filter.
+ * This is a global object, all styles will be placed here before output.
+ */
+class XFStyleManager
+{
+public:
+ XFStyleManager();
+ ~XFStyleManager();
+ XFStyleManager(XFStyleManager&);
+
+public:
+ /**
+ * @descr clear all styles, called before load file.
+ */
+ void Reset();
+
+ void AddFontDecl(XFFontDecl const & aFontDecl);
+
+ IXFStyleRet AddStyle(std::unique_ptr<IXFStyle> pStyle);
+
+ IXFStyle* FindStyle(const OUString& name);
+
+ XFParaStyle* FindParaStyle(const OUString& name);
+
+ XFTextStyle* FindTextStyle(const OUString& name);
+
+ void SetLineNumberConfig(XFLineNumberConfig *pLNConfig);
+
+ void SetFootnoteConfig(XFFootnoteConfig *pFNConfig);
+
+ void SetEndnoteConfig(XFEndnoteConfig *pFNConfig);
+
+ void ToXml(IXFStream *strm);
+
+private:
+ std::vector<XFFontDecl> s_aFontDecls;
+ //standard styles that can be inherited,<office:styles>
+ XFStyleContainer s_aStdTextStyles;
+ XFStyleContainer s_aStdParaStyles;
+ XFStyleContainer s_aStdStrokeDashStyles;
+ XFStyleContainer s_aStdAreaStyles;
+ XFStyleContainer s_aStdArrowStyles;
+ XFConfigManager s_aConfigManager;
+ //automatic styles,<office:automatic-styles>
+ XFStyleContainer s_aTextStyles;
+ XFStyleContainer s_aParaStyles;
+ XFStyleContainer s_aListStyles;
+ XFStyleContainer s_aSectionStyles;
+ XFStyleContainer s_aPageMasters;
+ XFStyleContainer s_aMasterpages;
+ XFStyleContainer s_aDateStyles;
+ XFStyleContainer s_aGraphicsStyles;
+ XFStyleContainer s_aTableStyles;
+ XFStyleContainer s_aTableCellStyles;
+ XFStyleContainer s_aTableRowStyles;
+ XFStyleContainer s_aTableColStyles;
+ std::unique_ptr<IXFStyle> s_pOutlineStyle;
+ XFStyleContainer s_aRubyStyles;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftable.hxx b/lotuswordpro/inc/xfilter/xftable.hxx
new file mode 100644
index 000000000..f36a1f295
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftable.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTABLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTABLE_HXX
+
+#include <xfilter/xfcontent.hxx>
+#include <xfilter/xfrow.hxx>
+#include <xfilter/xfcell.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <map>
+#include <vector>
+
+class XFTable : public XFContent
+{
+public:
+ XFTable();
+
+ virtual ~XFTable() override;
+
+public:
+ void SetTableName(const OUString& name);
+
+ void SetColumnStyle(sal_Int32 col, const OUString& style);
+
+ void AddRow(rtl::Reference<XFRow> const & rRow);
+
+ void AddHeaderRow(XFRow *pRow);
+
+public:
+ void SetOwnerCell(XFCell *pCell);
+
+ OUString GetTableName();
+
+ sal_uInt16 GetRowCount();
+
+ XFRow* GetRow(sal_Int32 row);
+
+ sal_Int32 GetColumnCount();
+
+ bool IsSubTable() const;
+
+ enumXFContent GetContentType() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ void RemoveRow(sal_uInt16 row)
+ {
+ m_aRows.erase(row);
+ }
+
+private:
+ OUString m_strName;
+ bool m_bSubTable;
+ XFCell *m_pOwnerCell;
+ rtl::Reference<XFContentContainer> m_aHeaderRows;
+ std::map<sal_uInt16, rtl::Reference<XFRow>> m_aRows;
+ std::map<sal_Int32,OUString> m_aColumns;
+ OUString m_strDefCellStyle;
+ OUString m_strDefRowStyle;
+ OUString m_strDefColStyle;
+};
+
+inline void XFTable::SetTableName(const OUString& name)
+{
+ m_strName = name;
+}
+
+inline void XFTable::SetOwnerCell(XFCell *pCell)
+{
+ m_pOwnerCell = pCell;
+ m_bSubTable = (pCell!=nullptr);
+}
+
+inline bool XFTable::IsSubTable() const
+{
+ return m_bSubTable;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftablestyle.hxx b/lotuswordpro/inc/xfilter/xftablestyle.hxx
new file mode 100644
index 000000000..7fff8c45e
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftablestyle.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table style.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTABLESTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTABLESTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfbreaks.hxx>
+#include <memory>
+
+class XFBGImage;
+class XFTableStyle : public XFStyle
+{
+public:
+ XFTableStyle();
+
+ virtual ~XFTableStyle() override;
+
+public:
+ void SetWidth(double width);
+
+ void SetAlign(enumXFAlignType eAlign, double offset = 0);
+
+ void SetShadow(enumXFShadowPos pos, double offset, XFColor color );
+
+ void SetBackColor(XFColor const & color);
+
+ void SetBackImage(std::unique_ptr<XFBGImage>& rImage);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+private:
+ double m_fWidth;
+ XFColor m_aBackColor;
+ std::unique_ptr<XFBGImage> m_pBGImage;
+ XFShadow m_aShadow;
+ XFMargins m_aMargins;
+ XFBreaks m_aBreaks;
+ enumXFAlignType m_eAlign;
+};
+
+inline void XFTableStyle::SetWidth(double width)
+{
+ m_fWidth = width;
+}
+
+inline void XFTableStyle::SetAlign(enumXFAlignType eAlign, double offset)
+{
+ m_eAlign = eAlign;
+ if( m_eAlign == enumXFAlignStart )
+ {
+ m_aMargins.SetLeft(offset);
+ m_aMargins.SetRight(0);
+ m_aMargins.SetTop(0);
+ m_aMargins.SetBottom(0);
+ }
+}
+
+inline void XFTableStyle::SetShadow(enumXFShadowPos pos, double offset, XFColor color)
+{
+ m_aShadow.SetColor(color);
+ m_aShadow.SetOffset(offset);
+ m_aShadow.SetPosition(pos);
+}
+
+inline void XFTableStyle::SetBackColor(XFColor const & color)
+{
+ m_aBackColor = color;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftabstop.hxx b/lotuswordpro/inc/xfilter/xftabstop.hxx
new file mode 100644
index 000000000..2f5ad8930
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftabstop.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**************************************************************************
+ * @file
+ * Tab stop object,<text:tab-stop/>
+ *************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTABSTOP_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTABSTOP_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfcontent.hxx>
+
+class XFTabStop : public XFContent
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+inline void XFTabStop::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pStrm->StartElement( "text:tab-stop" );
+ pStrm->EndElement( "text:tab-stop" );
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftextboxstyle.hxx b/lotuswordpro/inc/xfilter/xftextboxstyle.hxx
new file mode 100644
index 000000000..e1b5bbaf1
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftextboxstyle.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTBOXSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTBOXSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+
+/**
+* @brief
+* Style for all frame objects.
+*/
+class XFTextBoxStyle : public XFStyle
+{
+public:
+ XFTextBoxStyle();
+
+ virtual ~XFTextBoxStyle() override;
+
+public:
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream* pStrm) override;
+
+protected:
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftextcontent.hxx b/lotuswordpro/inc/xfilter/xftextcontent.hxx
new file mode 100644
index 000000000..dca2c69c2
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftextcontent.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTCONTENT_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTCONTENT_HXX
+
+#include <xfilter/xfcontent.hxx>
+
+class IXFStream;
+
+/**
+ * @brief
+ * Adapter for text to content.
+ */
+class XFTextContent : public XFContent
+{
+public:
+ XFTextContent() {}
+
+ explicit XFTextContent(const OUString& text);
+
+ virtual ~XFTextContent() override;
+
+public:
+ /**
+ * @descr Set the text.
+ */
+ void SetText(const OUString& text);
+
+ virtual enumXFContent GetContentType() override;
+
+ virtual void ToXml(IXFStream* pStrm) override;
+
+private:
+ OUString m_strText;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftextspan.hxx b/lotuswordpro/inc/xfilter/xftextspan.hxx
new file mode 100644
index 000000000..2e210f357
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftextspan.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * An span of text with style.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTSPAN_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTSPAN_HXX
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <rtl/ref.hxx>
+
+#include <xfilter/xfcontent.hxx>
+
+class IXFStream;
+
+class XFTextSpan : public XFContent
+{
+public:
+ XFTextSpan();
+ XFTextSpan(const OUString& text, const OUString& style );
+
+ virtual ~XFTextSpan() override;
+
+ void Add(XFContent *pContent);
+ void Add(const OUString& text);
+
+ virtual enumXFContent GetContentType() override;
+ virtual void ToXml(IXFStream *pStrm) override;
+protected:
+ std::vector< rtl::Reference<XFContent> > m_aContents;
+};
+
+class XFTextSpanStart : public XFTextSpan //for adding style of power field
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+class XFTextSpanEnd : public XFTextSpan //for adding style of power field
+{
+public:
+ virtual void ToXml(IXFStream *pStrm) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftextstyle.hxx b/lotuswordpro/inc/xfilter/xftextstyle.hxx
new file mode 100644
index 000000000..2774426d7
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftextstyle.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style for <text:p> or <text:h> or <text:span>
+ * Now we have only font attributes.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTEXTSTYLE_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include <xfilter/xfstyle.hxx>
+
+class IXFStream;
+class XFFont;
+
+class XFTextStyle : public XFStyle
+{
+public:
+ XFTextStyle();
+
+ virtual ~XFTextStyle() override;
+
+ XFTextStyle(XFTextStyle const &) = default;
+ XFTextStyle(XFTextStyle &&) = default;
+ XFTextStyle & operator =(XFTextStyle const &) = default;
+ XFTextStyle & operator =(XFTextStyle &&) = default;
+
+public:
+ /**
+ * @descr: set the font for the text span.
+ */
+ void SetFont(rtl::Reference<XFFont> const & font);
+
+ const rtl::Reference<XFFont>& GetFont() const { return m_pFont; }
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual bool Equal(IXFStyle *pStyle) override;
+
+ virtual void ToXml(IXFStream *strm) override;
+
+private:
+ rtl::Reference<XFFont> m_pFont;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xftimestyle.hxx b/lotuswordpro/inc/xfilter/xftimestyle.hxx
new file mode 100644
index 000000000..f27637cb6
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xftimestyle.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Time style. The Time format for time field.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTIMESTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFTIMESTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <vector>
+
+class XFDateTimePart : public XFStyle
+{
+public:
+ XFDateTimePart()
+ : m_ePart(enumXFDateUnknown)
+ , m_bLongFmt(false)
+ {}
+
+ void SetPartType(enumXFDatePart ePart);
+
+ void SetLongFmt(bool bLongFmt);
+
+ void SetText(const OUString& text);
+
+protected:
+ enumXFDatePart m_ePart;
+ bool m_bLongFmt;
+ OUString m_strText;
+};
+
+class XFTimePart : public XFDateTimePart
+{
+public:
+ XFTimePart();
+
+ void SetDecimalPos(sal_Int32 pos);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+protected:
+ sal_Int32 m_nDecimalPos;
+};
+
+class XFTimeStyle : public XFStyle
+{
+public:
+ XFTimeStyle();
+
+ virtual ~XFTimeStyle() override;
+
+public:
+
+ void AddHour( bool bLongFmt = true );
+
+ void AddMinute( bool bLongFmt = true );
+
+ void AddSecond( bool bLongFmt = true );
+
+ void SetAmPm(bool bAmPm);
+
+ void AddText( const OUString& part );
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+ void SetTruncate(bool bTrunc);
+
+private:
+ bool m_bAmPm;
+ std::vector<XFTimePart> m_aParts;
+ bool m_bTruncate;
+};
+
+inline void XFDateTimePart::SetPartType(enumXFDatePart ePart)
+{
+ m_ePart = ePart;
+}
+
+inline void XFDateTimePart::SetLongFmt(bool bLongFmt)
+{
+ m_bLongFmt = bLongFmt;
+}
+
+inline void XFDateTimePart::SetText(const OUString& text)
+{
+ m_strText = text;
+}
+
+inline void XFTimePart::SetDecimalPos(sal_Int32 pos)
+{
+ m_nDecimalPos = pos;
+}
+
+inline void XFTimeStyle::AddHour( bool bLongFmt )
+{
+ XFTimePart part;
+ part.SetPartType(enumXFDateHour);
+ part.SetLongFmt(bLongFmt);
+ m_aParts.push_back(part);
+}
+
+inline void XFTimeStyle::AddMinute( bool bLongFmt )
+{
+ XFTimePart part;
+ part.SetPartType(enumXFDateMinute);
+ part.SetLongFmt(bLongFmt);
+ m_aParts.push_back(part);
+}
+
+inline void XFTimeStyle::AddSecond( bool bLongFmt )
+{
+ XFTimePart part;
+ part.SetPartType(enumXFDateSecond);
+ part.SetLongFmt(bLongFmt);
+ part.SetDecimalPos(0);
+ m_aParts.push_back(part);
+}
+
+inline void XFTimeStyle::SetAmPm(bool bAmPm)
+{
+ m_bAmPm = bAmPm;
+}
+
+inline void XFTimeStyle::AddText( const OUString& text )
+{
+ XFTimePart part;
+ part.SetPartType(enumXFDateText);
+ part.SetText(text);
+ m_aParts.push_back(part);
+}
+
+inline void XFTimeStyle::SetTruncate(bool bTrunc)
+{
+ m_bTruncate = bTrunc;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/inc/xfilter/xfutil.hxx b/lotuswordpro/inc/xfilter/xfutil.hxx
new file mode 100644
index 000000000..8d2f9225c
--- /dev/null
+++ b/lotuswordpro/inc/xfilter/xfutil.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tool functions for xml filter.
+ * Don't use any template for the ***TOOUString function list for easy.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFUTIL_HXX
+#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFUTIL_HXX
+
+#include <xfilter/xfdefs.hxx>
+#include <rtl/ustring.hxx>
+
+OUString GetTableColName(sal_Int32 col);
+
+OUString GetUnderlineName(enumXFUnderline type);
+
+OUString GetCrossoutName(enumXFCrossout type);
+
+OUString GetTransformName(enumXFTransform type);
+
+OUString GetTextDirName(enumXFTextDir dir);
+
+OUString GetFrameXPos(enumXFFrameXPos pos);
+
+OUString GetFrameXRel(enumXFFrameXRel rel);
+
+OUString GetFrameYPos(enumXFFrameYPos pos);
+
+OUString GetFrameYRel(enumXFFrameYRel rel);
+
+OUString GetAlignName(enumXFAlignType align);
+
+OUString GetPageUsageName(enumXFPageUsage usage);
+
+OUString GetValueType(enumXFValueType type);
+
+OUString GetColorMode(enumXFColorMode mode);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/qa/cppunit/data/fail/A14.lwp b/lotuswordpro/qa/cppunit/data/fail/A14.lwp
new file mode 100644
index 000000000..9dd36f626
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/A14.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp b/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp
new file mode 100644
index 000000000..fb4a7e80e
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp b/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp
new file mode 100644
index 000000000..7672793e7
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp
new file mode 100644
index 000000000..d610a3ed6
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp
new file mode 100644
index 000000000..6342cc56e
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/null-1.lwp b/lotuswordpro/qa/cppunit/data/fail/null-1.lwp
new file mode 100644
index 000000000..06b825443
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/null-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/null-2.lwp b/lotuswordpro/qa/cppunit/data/fail/null-2.lwp
new file mode 100644
index 000000000..cd7e07278
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/null-2.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp
new file mode 100644
index 000000000..afbf57804
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp
new file mode 100644
index 000000000..5b068065a
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp
new file mode 100644
index 000000000..ffc7a44e3
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp
new file mode 100644
index 000000000..f19b0d7f7
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp
new file mode 100644
index 000000000..acb8c93ce
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
new file mode 100644
index 000000000..f48c5bb71
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp
new file mode 100644
index 000000000..a81b42f61
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp
new file mode 100644
index 000000000..d8141ae6d
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp
new file mode 100644
index 000000000..d2101d8fe
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp
new file mode 100644
index 000000000..6076b43b7
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp b/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp
new file mode 100644
index 000000000..f3419f45b
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp b/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp
new file mode 100644
index 000000000..60eb8e393
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp
new file mode 100644
index 000000000..3d906ee68
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore b/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore
diff --git a/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp b/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp
new file mode 100644
index 000000000..dc4048cb9
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp b/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp
new file mode 100644
index 000000000..786164ea4
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp b/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp
new file mode 100644
index 000000000..7cc05cebc
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/null-1.lwp b/lotuswordpro/qa/cppunit/data/pass/null-1.lwp
new file mode 100644
index 000000000..351d7e88e
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/null-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp
new file mode 100644
index 000000000..26fc903db
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp
new file mode 100644
index 000000000..de6dcbf1c
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp b/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp
new file mode 100644
index 000000000..0f0645e3b
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp b/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp
new file mode 100644
index 000000000..fc351f434
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp b/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp
new file mode 100644
index 000000000..dc4048cb9
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/data/tdf129993.lwp b/lotuswordpro/qa/cppunit/data/tdf129993.lwp
new file mode 100644
index 000000000..54bc9ac99
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/tdf129993.lwp
Binary files differ
diff --git a/lotuswordpro/qa/cppunit/import_test.cxx b/lotuswordpro/qa/cppunit/import_test.cxx
new file mode 100644
index 000000000..8ffddc215
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/import_test.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+
+class LotusWordProTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+public:
+ virtual void setUp() override;
+
+ virtual void tearDown() override;
+ uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+
+private:
+ uno::Reference<lang::XComponent> mxComponent;
+};
+
+void LotusWordProTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void LotusWordProTest::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+char const DATA_DIRECTORY[] = "/lotuswordpro/qa/cppunit/data/";
+
+CPPUNIT_TEST_FIXTURE(LotusWordProTest, testTdf129993)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf129993.lwp";
+ getComponent() = loadFromDesktop(aURL);
+ CPPUNIT_ASSERT(getComponent().is());
+
+ uno::Reference<text::XTextDocument> textDocument(getComponent(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(),
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ for (int i = 0; i < 15; ++i)
+ xParaEnum->nextElement();
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xParaEnum->nextElement(), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(sal_True, xServiceInfo->supportsService("com.sun.star.text.TextTable"));
+}
+
+CPPUNIT_TEST_FIXTURE(LotusWordProTest, paragraphProperties)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "paragraphProperties.lwp";
+ getComponent() = loadFromDesktop(aURL);
+ CPPUNIT_ASSERT(getComponent().is());
+
+ uno::Reference<text::XTextDocument> textDocument(getComponent(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(),
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+
+ //Ignore the first paragraphs
+ for (int i = 0; i < 4; ++i)
+ xParaEnum->nextElement();
+
+ // bold
+ uno::Reference<text::XTextRange> const xParagraph(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet(xParagraph, uno::UNO_QUERY);
+ float fFontWeight;
+ xPropertySet->getPropertyValue("CharWeight") >>= fFontWeight;
+ CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, fFontWeight);
+
+ // italic
+ uno::Reference<text::XTextRange> const xParagraph2(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet2(xParagraph2, uno::UNO_QUERY);
+ awt::FontSlant fFontSlant;
+ xPropertySet2->getPropertyValue("CharPosture") >>= fFontSlant;
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, fFontSlant);
+
+ // underline
+ uno::Reference<text::XTextRange> const xParagraph3(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet3(xParagraph3, uno::UNO_QUERY);
+ sal_Int16 nCharUnderline;
+ xPropertySet3->getPropertyValue("CharUnderline") >>= nCharUnderline;
+ CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::SINGLE, nCharUnderline);
+
+ // striked through
+ uno::Reference<text::XTextRange> const xParagraph4(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet4(xParagraph4, uno::UNO_QUERY);
+ sal_Int16 nFontStrikeout;
+ xPropertySet4->getPropertyValue("CharStrikeout") >>= nFontStrikeout;
+ CPPUNIT_ASSERT_EQUAL(awt::FontStrikeout::SINGLE, nFontStrikeout);
+
+ //superscript
+ uno::Reference<text::XTextRange> const xParagraph5(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet5(xParagraph5, uno::UNO_QUERY);
+ sal_Int32 nCharEscapement;
+ xPropertySet5->getPropertyValue("CharEscapement") >>= nCharEscapement;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(33), nCharEscapement);
+
+ sal_Int32 nCharEscapementHeight;
+ xPropertySet5->getPropertyValue("CharEscapementHeight") >>= nCharEscapementHeight;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nCharEscapementHeight);
+
+ //subscript
+ uno::Reference<text::XTextRange> const xParagraph6(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet6(xParagraph6, uno::UNO_QUERY);
+ sal_Int32 nCharEscapement2;
+ xPropertySet6->getPropertyValue("CharEscapement") >>= nCharEscapement2;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-33), nCharEscapement2);
+
+ sal_Int32 nCharEscapementHeight2;
+ xPropertySet6->getPropertyValue("CharEscapementHeight") >>= nCharEscapementHeight2;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nCharEscapementHeight2);
+
+ // red background and borders
+ uno::Reference<text::XTextRange> const xParagraph7(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet7(xParagraph7, uno::UNO_QUERY);
+ Color nParaBackColor;
+ xPropertySet7->getPropertyValue("ParaBackColor") >>= nParaBackColor;
+ CPPUNIT_ASSERT_EQUAL(Color(0xff0000), nParaBackColor);
+
+ table::BorderLine2 aTopBorder;
+ xPropertySet7->getPropertyValue("TopBorder") >>= aTopBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aTopBorder.OuterLineWidth);
+
+ table::BorderLine2 aBottomBorder;
+ xPropertySet7->getPropertyValue("BottomBorder") >>= aBottomBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aBottomBorder.OuterLineWidth);
+
+ table::BorderLine2 aLeftBorder;
+ xPropertySet7->getPropertyValue("LeftBorder") >>= aLeftBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aLeftBorder.OuterLineWidth);
+
+ table::BorderLine2 aRightBorder;
+ xPropertySet7->getPropertyValue("RightBorder") >>= aRightBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aRightBorder.OuterLineWidth);
+
+ // centered
+ uno::Reference<text::XTextRange> const xParagraph8(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet8(xParagraph8, uno::UNO_QUERY);
+ sal_Int16 nParaAdjust = {}; // spurious -Werror=maybe-uninitialized
+ xPropertySet8->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER,
+ static_cast<style::ParagraphAdjust>(nParaAdjust));
+
+ // left margin
+ uno::Reference<text::XTextRange> const xParagraph9(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet9(xParagraph9, uno::UNO_QUERY);
+ sal_Int32 nParaLeftMargin;
+ xPropertySet9->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nParaLeftMargin);
+
+ // double line spacing
+ uno::Reference<text::XTextRange> const xParagraph10(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet10(xParagraph10, uno::UNO_QUERY);
+ style::LineSpacing nParaLineSpacing;
+ xPropertySet10->getPropertyValue("ParaLineSpacing") >>= nParaLineSpacing;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(200), nParaLineSpacing.Height);
+
+ // time new roman 12
+ uno::Reference<text::XTextRange> const xParagraph11(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet11(xParagraph11, uno::UNO_QUERY);
+ OUString sCharFontName;
+ xPropertySet11->getPropertyValue("CharFontName") >>= sCharFontName;
+ CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), sCharFontName);
+ float fCharFontHeight;
+ xPropertySet11->getPropertyValue("CharHeight") >>= fCharFontHeight;
+ CPPUNIT_ASSERT_EQUAL(float(12.), fCharFontHeight);
+
+ // time new roman 16
+ uno::Reference<text::XTextRange> const xParagraph12(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet12(xParagraph12, uno::UNO_QUERY);
+ OUString sCharFontName2;
+ xPropertySet12->getPropertyValue("CharFontName") >>= sCharFontName2;
+ CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), sCharFontName2);
+ float fCharFontHeight2;
+ xPropertySet12->getPropertyValue("CharHeight") >>= fCharFontHeight2;
+ CPPUNIT_ASSERT_EQUAL(float(16.), fCharFontHeight2);
+
+ //ignore this paragraph
+ xParaEnum->nextElement();
+
+ //text color
+ uno::Reference<text::XTextRange> const xParagraph13(xParaEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet13(xParagraph13, uno::UNO_QUERY);
+ Color nCharColor;
+ xPropertySet13->getPropertyValue("CharColor") >>= nCharColor;
+ CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), nCharColor);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
new file mode 100644
index 000000000..961faa668
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
+#include <com/sun/star/document/XFilter.hpp>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+ class LotusWordProTest
+ : public test::FiltersTest
+ , public test::BootstrapFixture
+ {
+ public:
+ LotusWordProTest() : BootstrapFixture(true, false) {}
+
+ virtual void setUp() override;
+
+ virtual bool load(const OUString &,
+ const OUString &rURL, const OUString &,
+ SfxFilterFlags, SotClipboardFormatId, unsigned int) override;
+
+ void test();
+
+ CPPUNIT_TEST_SUITE(LotusWordProTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+ private:
+ uno::Reference<document::XFilter> m_xFilter;
+ };
+
+ void LotusWordProTest::setUp()
+ {
+ test::BootstrapFixture::setUp();
+
+ m_xFilter.set(m_xSFactory->createInstance(
+ "com.sun.star.comp.Writer.LotusWordProImportFilter"),
+ uno::UNO_QUERY_THROW);
+ }
+
+ bool LotusWordProTest::load(const OUString &,
+ const OUString &rURL, const OUString &,
+ SfxFilterFlags, SotClipboardFormatId, unsigned int)
+ {
+ uno::Sequence< beans::PropertyValue > aDescriptor(1);
+ aDescriptor[0].Name = "URL";
+ aDescriptor[0].Value <<= rURL;
+ return m_xFilter->filter(aDescriptor);
+ }
+
+ void LotusWordProTest::test()
+ {
+ testDir(OUString(),
+ m_directories.getURLFromSrc("/lotuswordpro/qa/cppunit/data/"));
+ }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(LotusWordProTest);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
new file mode 100644
index 000000000..16650de33
--- /dev/null
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/supportsservice.hxx>
+#include <rtl/tencinfo.h>
+#include <sal/macros.h>
+#include <tools/stream.hxx>
+#include <vector>
+#include <ucbhelper/content.hxx>
+#include <xmloff/attrlist.hxx>
+
+#include "LotusWordProImportFilter.hxx"
+#include "lwpfilter.hxx"
+
+using namespace com::sun::star;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::Exception;
+using com::sun::star::io::XInputStream;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::ucb::XCommandEnvironment;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::XDocumentHandler;
+
+// W o r d P r o
+static const sal_Int8 header[] = { 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f };
+
+bool LotusWordProImportFilter::importImpl( const Sequence< css::beans::PropertyValue >& aDescriptor )
+{
+ OUString sURL;
+ for (const PropertyValue& rValue : aDescriptor)
+ {
+ //Note, we should attempt to use InputStream here first!
+ if ( rValue.Name == "URL" )
+ rValue.Value >>= sURL;
+ }
+
+ SvFileStream inputStream( sURL, StreamMode::READ );
+ if (!inputStream.good())
+ return false;
+
+ // An XML import service: what we push sax messages to...
+ uno::Reference< XDocumentHandler > xInternalHandler(
+ mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.comp.Writer.XMLImporter", mxContext ), UNO_QUERY );
+ uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+ if (xImporter.is())
+ xImporter->setTargetDocument(mxDoc);
+
+ return ( ReadWordproFile( inputStream, xInternalHandler) == 0 );
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportLWP(SvStream &rStream)
+{
+ uno::Reference< XDocumentHandler > xHandler;
+ return ReadWordproFile(rStream, xHandler) == 0;
+}
+
+sal_Bool SAL_CALL LotusWordProImportFilter::filter( const Sequence< css::beans::PropertyValue >& aDescriptor )
+{
+ return importImpl ( aDescriptor );
+}
+void SAL_CALL LotusWordProImportFilter::cancel( )
+{
+}
+
+// XImporter
+void SAL_CALL LotusWordProImportFilter::setTargetDocument( const uno::Reference< css::lang::XComponent >& xDoc )
+{
+ mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL LotusWordProImportFilter::detect( css::uno::Sequence< PropertyValue >& Descriptor )
+{
+ OUString sTypeName( "writer_LotusWordPro_Document" );
+ OUString sURL;
+ uno::Reference < XInputStream > xInputStream;
+ for (const PropertyValue& rValue : std::as_const(Descriptor))
+ {
+ if ( rValue.Name == "TypeName" )
+ rValue.Value >>= sTypeName;
+ else if ( rValue.Name == "InputStream" )
+ rValue.Value >>= xInputStream;
+ else if ( rValue.Name == "URL" )
+ rValue.Value >>= sURL;
+ }
+
+ uno::Reference< css::ucb::XCommandEnvironment > xEnv;
+ if (!xInputStream.is())
+ {
+ try
+ {
+ ::ucbhelper::Content aContent(sURL, xEnv, mxContext);
+ xInputStream = aContent.openStream();
+ }
+ catch ( Exception& )
+ {
+ return OUString();
+ }
+
+ if (!xInputStream.is())
+ return OUString();
+ }
+
+ Sequence< ::sal_Int8 > aData;
+ sal_Int32 nLen = SAL_N_ELEMENTS( header );
+ if ( !( ( nLen == xInputStream->readBytes( aData, nLen ) )
+ && ( memcmp( static_cast<void const *>(header), static_cast<void const *>(aData.getConstArray()), nLen ) == 0 ) ) )
+ sTypeName.clear();
+
+ return sTypeName;
+}
+
+// XInitialization
+void SAL_CALL LotusWordProImportFilter::initialize( const Sequence< Any >& /*aArguments*/ )
+{
+}
+
+// XServiceInfo
+OUString SAL_CALL LotusWordProImportFilter::getImplementationName()
+{
+ return "com.sun.star.comp.Writer.LotusWordProImportFilter";
+}
+
+sal_Bool SAL_CALL LotusWordProImportFilter::supportsService(const OUString& rServiceName)
+{
+ return cppu::supportsService(this, rServiceName);
+}
+
+Sequence<OUString> SAL_CALL LotusWordProImportFilter::getSupportedServiceNames()
+{
+ return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+LotusWordProImportFilter_get_implementation(
+ css::uno::XComponentContext *context,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(new LotusWordProImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.hxx b/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
new file mode 100644
index 000000000..e0843e040
--- /dev/null
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LOTUSWORDPROIMPORTFILTER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LOTUSWORDPROIMPORTFILTER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+
+/* This component will be instantiated for both import or export. Whether it calls
+ * setSourceDocument or setTargetDocument determines which Impl function the filter
+ * member calls */
+class LotusWordProImportFilter final : public cppu::WeakImplHelper
+<
+ css::document::XFilter,
+ css::document::XImporter,
+ css::document::XExtendedFilterDetection,
+ css::lang::XInitialization,
+ css::lang::XServiceInfo
+>
+{
+ // oo.org declares
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::lang::XComponent > mxDoc;
+
+ /// @throws css::uno::RuntimeException
+ bool importImpl( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor );
+
+public:
+ explicit LotusWordProImportFilter( const css::uno::Reference< css::uno::XComponentContext > &rxContext)
+ : mxContext( rxContext )
+ {
+ }
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
+ virtual void SAL_CALL cancel( ) override;
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
+
+ //XExtendedFilterDetection
+ virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& Descriptor ) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx
new file mode 100644
index 000000000..ca63a961e
--- /dev/null
+++ b/lotuswordpro/source/filter/bencont.cxx
@@ -0,0 +1,332 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "first.hxx"
+#include "tocread.hxx"
+#include <assert.h>
+#include <stdio.h>
+#include <algorithm>
+#include <osl/diagnose.h>
+#include <sot/storinfo.hxx>
+namespace OpenStormBento
+{
+
+// String definitions
+const char gsBenMagicBytes[] = BEN_MAGIC_BYTES;
+
+/**
+* New bento container from file stream
+* @param pointer to length of bento file
+* @param pointer to pointer of Bento Container object
+* @return error code
+*/
+sal_uLong BenOpenContainer(LwpSvStream * pStream, std::unique_ptr<LtcBenContainer>* ppContainer)
+{
+ *ppContainer = nullptr;
+
+ if (nullptr == pStream)
+ {
+ return BenErr_ContainerWithNoObjects;
+ }
+
+ std::unique_ptr<LtcBenContainer> pContainer(new LtcBenContainer(pStream));
+ if (pContainer->Open() != BenErr_OK) // delete two inputs
+ {
+ return BenErr_InvalidTOC;
+ }
+
+ *ppContainer = std::move(pContainer);
+ return BenErr_OK;
+}
+
+LtcBenContainer::~LtcBenContainer()
+{
+}
+
+BenError
+LtcBenContainer::Open() // delete two inputs
+{
+ BenError Err;
+ CBenTOCReader TOCReader(this);
+ if ((Err = TOCReader.ReadLabelAndTOC()) != BenErr_OK)
+ {
+ return Err;
+ }
+ return BenErr_OK;
+}
+
+void
+LtcBenContainer::RegisterPropertyName(const char * sPropertyName,
+ CBenPropertyName ** ppPropertyName)
+{
+ CUtListElmt * pPrevNamedObjectListElmt;
+ CBenNamedObject * pNamedObject = FindNamedObject(&cNamedObjects,
+ sPropertyName, &pPrevNamedObjectListElmt);
+
+ if (pNamedObject != nullptr)
+ {
+ if (! pNamedObject->IsPropertyName())
+ return;
+ else *ppPropertyName = static_cast<CBenPropertyName *>(pNamedObject);
+ }
+ else
+ {
+ CUtListElmt * pPrevObject;
+ if (FindID(&cObjects, cNextAvailObjectID, &pPrevObject) != nullptr)
+ return;
+
+ *ppPropertyName = new CBenPropertyName(this, cNextAvailObjectID,
+ pPrevObject, sPropertyName, pPrevNamedObjectListElmt);
+ ++cNextAvailObjectID;
+ }
+}
+
+CBenObject *
+LtcBenContainer::GetNextObject(CBenObject const * pCurrObject)
+{
+ return static_cast<CBenObject *>(cObjects.GetNextOrNULL(pCurrObject));
+}
+
+CBenObject *
+LtcBenContainer::FindNextObjectWithProperty(CBenObject * pCurrObject,
+ BenObjectID PropertyID)
+{
+ while ((pCurrObject = GetNextObject(pCurrObject)) != nullptr)
+ if (pCurrObject->UseProperty(PropertyID) != nullptr)
+ return pCurrObject;
+
+ return nullptr;
+}
+
+/**
+* Construction
+* @param Bento file stream pointer
+* @return
+*/
+LtcBenContainer::LtcBenContainer(LwpSvStream * pStream)
+ : cNextAvailObjectID(0)
+{
+ cpStream = pStream;
+ pStream->Seek(STREAM_SEEK_TO_END);
+ m_ulLength = pStream->Tell();
+ pStream->Seek(STREAM_SEEK_TO_BEGIN);
+}
+
+/**
+* Read buffer for bento file with specified buffer
+* @param buffer pointer
+* @param buffer size
+* @param number of bytes read
+*/
+void LtcBenContainer::Read(void * pBuffer, size_t MaxSize,
+ size_t* pAmtRead)
+{
+ *pAmtRead = cpStream->Read(pBuffer, MaxSize);
+}
+/**
+* Read buffer from bento file with specified size
+* @param buffer pointer
+* @param number of bytes to be read
+* @return BenError
+*/
+BenError LtcBenContainer::ReadKnownSize(void * pBuffer, size_t Amt)
+{
+ size_t ulLength = cpStream->Read(pBuffer, Amt);
+ if (ulLength == Amt)
+ {
+ return BenErr_OK;
+ }
+ return BenErr_ReadPastEndOfContainer;
+}
+/**
+* Seek to position from the beginning of the bento file
+* @param position in container file from beginning
+*/
+void LtcBenContainer::SeekToPosition(BenContainerPos Pos)
+{
+ cpStream->Seek(Pos);
+}
+/**
+* Seek to position compare to end of bento file
+* @param position in container file from end
+*/
+void LtcBenContainer::SeekFromEnd(long Offset)
+{
+ cpStream->Seek(STREAM_SEEK_TO_END);
+ cpStream->SeekRel(Offset);
+}
+/**
+* Find the next value stream with property name
+* @param string of property name
+* @return next value stream pointer with the property names
+*/
+LtcUtBenValueStream * LtcBenContainer::FindNextValueStreamWithPropertyName(const char * sPropertyName)
+{
+ CBenPropertyName * pPropertyName(nullptr);
+ RegisterPropertyName(sPropertyName, &pPropertyName); // Get property name object
+
+ if (nullptr == pPropertyName)
+ return nullptr; // Property not exist
+
+ // Get current object
+ CBenObject * pObj =FindNextObjectWithProperty(nullptr, pPropertyName->GetID()); // Get next object with same property name
+ if (nullptr == pObj)
+ return nullptr;
+
+ CBenValue * pValue;
+ LtcUtBenValueStream * pValueStream;
+
+ pValue = pObj->UseValue(pPropertyName->GetID());
+
+ pValueStream = new LtcUtBenValueStream(pValue);
+
+ return pValueStream;
+}
+
+/**
+* Find the unique value stream with property name
+* @param string of property name
+* @return the only value stream pointer with the property names
+*/
+LtcUtBenValueStream * LtcBenContainer::FindValueStreamWithPropertyName(const char * sPropertyName)
+{
+ return FindNextValueStreamWithPropertyName(sPropertyName);
+}
+
+namespace
+{
+ void readDataInBlocks(SvStream& rSt, sal_uInt64 nDLen, std::vector<sal_uInt8>& rData)
+ {
+ //read data in blocks as its more likely large values are simply broken
+ //and we'll run out of data before we need to realloc
+ for (sal_uInt64 i = 0; i < nDLen; i+= SAL_MAX_UINT16)
+ {
+ size_t nOldSize = rData.size();
+ size_t nBlock = std::min<size_t>(SAL_MAX_UINT16, nDLen - nOldSize);
+ rData.resize(nOldSize + nBlock);
+ size_t nReadBlock = rSt.ReadBytes(rData.data() + nOldSize, nBlock);
+ if (nBlock != nReadBlock)
+ {
+ rData.resize(nOldSize + nReadBlock);
+ break;
+ }
+ }
+ }
+}
+
+/**
+* Find hazily according to object ID
+* @param pObjectname - format as "GrXX,XXXXXXXX" wherein XX is high part of object ID, and XXXXXXXX is low part
+*/
+std::vector<sal_uInt8> LtcBenContainer::GetGraphicData(const char *pObjectName)
+{
+ std::vector<sal_uInt8> aData;
+ if (!pObjectName)
+ {
+ return aData;
+ }
+ // construct the string of property name
+ char sSName[64]="";
+ char sDName[64]="";
+
+ sprintf(sSName, "%s-S", pObjectName);
+ sprintf(sDName, "%s-D", pObjectName);
+
+ /* traverse the found properties and construct the stream vectors */
+ // get S&D's stream and merge them together
+ std::unique_ptr<SvStream> xS(FindValueStreamWithPropertyName(sSName));
+ std::unique_ptr<SvStream> xD(FindValueStreamWithPropertyName(sDName));
+
+ sal_uInt64 nDLen = 0;
+ if (xD)
+ {
+ nDLen = xD->TellEnd();
+ }
+ sal_uInt64 nSLen = 0;
+ if (xS)
+ {
+ nSLen = xS->TellEnd();
+ }
+
+ sal_uInt64 nLen = nDLen + nSLen;
+ OSL_ENSURE(nLen > 0, "expected a non-0 length");
+ // the 'D' stream is NULL or it has invalid length
+ if (nLen <= 0)
+ {
+ return aData;
+ }
+
+ if (xD)
+ {
+ readDataInBlocks(*xD, nDLen, aData);
+ xD.reset();
+ }
+ if (xS)
+ {
+ readDataInBlocks(*xS, nSLen, aData);
+ xS.reset();
+ }
+
+ return aData;
+}
+
+sal_uLong LtcBenContainer::remainingSize() const
+{
+ return m_ulLength - cpStream->Tell();
+}
+
+}// end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/benlist.cxx b/lotuswordpro/source/filter/benlist.cxx
new file mode 100644
index 000000000..e092c7cf6
--- /dev/null
+++ b/lotuswordpro/source/filter/benlist.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "first.hxx"
+namespace OpenStormBento
+{
+
+CBenNamedObject *
+FindNamedObject(CUtList * pList, const OString& rName,
+ CUtListElmt ** ppPrev)
+{
+ CUtListElmt& rTerminating = pList->GetTerminating();
+ for (CUtListElmt * pCurr = pList->GetLast(); pCurr != &rTerminating;
+ pCurr = pCurr->GetPrev())
+ {
+ CBenNamedObjectListElmt * pCurrNamedObjectListElmt =
+ static_cast<CBenNamedObjectListElmt *>(pCurr);
+
+ sal_Int32 Comp = rName.compareTo(pCurrNamedObjectListElmt->GetNamedObject()->
+ GetName());
+
+ if (Comp == 0)
+ return pCurrNamedObjectListElmt->GetNamedObject();
+ else if (Comp < 0)
+ continue;
+ else
+ {
+ if (ppPrev != nullptr)
+ *ppPrev = pCurrNamedObjectListElmt;
+ return nullptr;
+ }
+ }
+
+ if (ppPrev != nullptr)
+ *ppPrev = &rTerminating;
+ return nullptr;
+}
+
+// Assume list is of BenIDListElmt list elements, sorted by ID
+CBenIDListElmt *
+FindID(CUtList * pList, BenObjectID ObjectID, CUtListElmt ** ppPrev)
+{
+ CUtListElmt& rTerminating = pList->GetTerminating();
+ for (CUtListElmt * pCurr = pList->GetLast(); pCurr != &rTerminating;
+ pCurr = pCurr->GetPrev())
+ {
+ CBenIDListElmt * pCurrIDListElmt = static_cast<CBenIDListElmt *>(pCurr);
+
+ if (ObjectID == pCurrIDListElmt->GetID())
+ return pCurrIDListElmt;
+ else if (ObjectID < pCurrIDListElmt->GetID())
+ continue;
+ else
+ {
+ if (ppPrev != nullptr)
+ *ppPrev = pCurrIDListElmt;
+ return nullptr;
+ }
+ }
+
+ if (ppPrev != nullptr)
+ *ppPrev = &rTerminating;
+ return nullptr;
+}
+} //end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/benname.cxx b/lotuswordpro/source/filter/benname.cxx
new file mode 100644
index 000000000..9cdfd5b7c
--- /dev/null
+++ b/lotuswordpro/source/filter/benname.cxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "first.hxx"
+
+namespace OpenStormBento
+{
+// changed to remove warning
+CBenNamedObject::CBenNamedObject(LtcBenContainer * pContainer,
+ BenObjectID ObjectID, CUtListElmt * pPrevObject, const OString& rName,
+ CUtListElmt * pPrevNamedObjectListElmt)
+ : CBenObject(pContainer, ObjectID, pPrevObject)
+ , csName(rName)
+ , cNameListElmt(pPrevNamedObjectListElmt)
+{
+ cNameListElmt.SetNamedObject(this);
+}
+
+bool CBenNamedObject::IsPropertyName()
+{ return false; }
+
+bool CBenPropertyName::IsPropertyName()
+{ return true; }
+
+} // end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/benobj.cxx b/lotuswordpro/source/filter/benobj.cxx
new file mode 100644
index 000000000..6dfe53d21
--- /dev/null
+++ b/lotuswordpro/source/filter/benobj.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "first.hxx"
+
+namespace OpenStormBento
+{
+
+CBenProperty *
+CBenObject::UseProperty(BenObjectID PropertyID)
+{
+ CUtListElmt * pPrev;
+ return static_cast<CBenProperty *>( FindID(&cProperties, PropertyID, &pPrev) );
+}
+
+CBenValue *
+CBenObject::UseValue(BenObjectID PropertyID)
+{
+ CBenProperty * pProperty = UseProperty(PropertyID);
+ if (pProperty == nullptr)
+ return nullptr;
+ return &pProperty->UseValue();
+}
+
+}// end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/bento.hxx b/lotuswordpro/source/filter/bento.hxx
new file mode 100644
index 000000000..68850985b
--- /dev/null
+++ b/lotuswordpro/source/filter/bento.hxx
@@ -0,0 +1,378 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_BENTO_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_BENTO_HXX
+
+#include <sal/config.h>
+
+#include <cstring>
+#include <memory>
+#include <vector>
+#include <lwpsvstream.hxx>
+
+#define BEN_CC __stdcall
+#ifdef COMP_BENTO
+#define BEN_EXPORT __declspec(dllexport)
+#else
+#define BEN_EXPORT
+#endif
+
+#include "utlist.hxx"
+#include <tools/stream.hxx>
+#include <tools/solar.h>
+
+namespace OpenStormBento
+{
+
+#define BEN_CURR_MAJOR_VERSION 2
+#define BEN_CURR_MINOR_VERSION 0
+#define BEN_MAGIC_BYTES_SIZE 8
+#define BEN_LABEL_SIZE 24
+
+#define BEN_MAGIC_BYTES "\xA4""CM""\xA5""Hdr""\xD7"
+
+enum BenError
+{
+ BenErr_OK = 0,
+ BenErr_NameConflict = 1,
+ BenErr_DuplicateObjectID = 2,
+ BenErr_UnknownBentoFormatVersion = 3,
+ BenErr_NamedObjectError = 4,
+ BenErr_NamedObjectIllegalValue = 5,
+ BenErr_InvalidTOC = 6,
+ BenErr_64BitOffsetNotSupported = 7,
+ BenErr_ReadPastEndOfTOC = 8,
+ BenErr_ContainerWithNoObjects = 9,
+ BenErr_ObjectWithNoProperties = 10,
+ BenErr_PropertyWithNoValues = 11,
+ BenErr_IllegalInMemoryTOC = 12,
+ BenErr_PropertyAlreadyExists = 13,
+ BenErr_UnexpectedEndOfFile = 14,
+ BenErr_InvalidWriteOffset = 15,
+ BenErr_InvalidImmediateWrite = 16,
+ BenErr_TOCSeedError = 17,
+ BenErr_ReadPastEndOfContainer = 18,
+ BenErr_DuplicateName = 19,
+ BenErr_BadReferencedList = 20,
+ BenErr_IllegalContinuedImmediate = 21,
+ BenErr_NotBentoContainer = 22,
+ BenErr_PropertyWithMoreThanOneValue = 23
+
+ // IMPORTANT - UtStream errors (UtErr_...) are also valid Bento
+ // errors. They have codes of 100 and higher. When, say, a Bento
+ // container open fails due to an access violation (somebody else, say,
+ // has it open exclusive), will get a UtErr code. If define own
+ // subclass of UtStream (custom handler), can define own error codes--
+ // those should start at 200
+};
+
+class LtcBenContainer;
+class CBenObject;
+class CBenProperty;
+class CBenValue;
+class CBenValueSegment;
+class CBenNamedObject;
+class CBenPropertyName;
+
+typedef sal_uInt8 BenByte;
+typedef sal_uInt16 BenWord;
+typedef sal_uInt32 BenDWord;
+
+typedef sal_uInt32 BenContainerPos;
+typedef sal_uInt32 BenObjectID;
+typedef sal_uInt32 BenGeneration;
+
+sal_uLong BenOpenContainer(LwpSvStream * pStream, std::unique_ptr<LtcBenContainer>* ppContainer);
+
+class CBenIDListElmt : public CUtListElmt
+{
+public: // Internal methods
+ CBenIDListElmt(BenObjectID ID, CUtListElmt * pPrev) : CUtListElmt(pPrev), cID(ID)
+ { }
+ explicit CBenIDListElmt(BenObjectID ID) : cID(ID) { }
+ BenObjectID GetID() const { return cID; }
+
+private: // Data
+ BenObjectID cID;
+};
+
+class CBenNamedObjectListElmt : public CUtListElmt
+{
+public: // Methods
+ // added to remove warning
+ explicit CBenNamedObjectListElmt(CUtListElmt * pPrev) : CUtListElmt(pPrev)
+ { cpNamedObject = nullptr; }
+ void SetNamedObject(CBenNamedObject * pObj)
+ {
+ cpNamedObject = pObj;
+ }
+
+ CBenNamedObject * GetNamedObject() { return cpNamedObject; }
+
+private: // Data
+ CBenNamedObject * cpNamedObject;
+};
+
+class LtcUtBenValueStream : public SvStream
+{
+public:
+ explicit LtcUtBenValueStream(CBenValue * pValue);
+ virtual ~LtcUtBenValueStream() override;
+
+public: // Overridden methods
+
+ /* added by */
+ sal_uLong GetSize() const { return m_ulValueLength; };
+protected: // Overridden methods
+
+ virtual std::size_t GetData(void* pData, std::size_t nSize) override;
+ virtual std::size_t PutData(const void* pData, std::size_t nSize) override;
+ virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
+ virtual void SetSize( sal_uInt64 nSize ) override;
+ virtual void FlushData() override;
+
+private: // Data
+ CBenValue * cpValue;
+ size_t cCurrentPosition;
+
+ sal_uLong m_ulValueLength; // Added by , sum of length of all sub-valuesegments
+};
+
+class LtcBenContainer
+{
+public:
+ BenError Open();
+ void RegisterPropertyName(const char * sPropertyName,
+ CBenPropertyName ** ppPropertyName);
+ // Pass NULL to begin iteration. Done when returns NULL.
+ // Objects are returned in order of increasing ID
+ CBenObject * GetNextObject(CBenObject const * pCurrObject);
+ CBenObject * FindNextObjectWithProperty(CBenObject * pCurrObject,
+ BenObjectID PropertyID);
+
+public: // Internal methods
+ explicit LtcBenContainer(LwpSvStream * pStream);
+ ~LtcBenContainer();
+
+ sal_uLong remainingSize() const;
+ void Read(void * pBuffer, size_t MaxSize,
+ size_t* pAmtRead);
+ BenError ReadKnownSize(void * pBuffer, size_t Amt);
+ void SeekToPosition(BenContainerPos Pos);
+ void SeekFromEnd(long Offset);
+
+ void SetNextAvailObjectID(BenObjectID ID) { cNextAvailObjectID = ID; }
+ CUtList& GetObjects() { return cObjects; }
+ CUtList& GetNamedObjects() { return cNamedObjects; }
+
+ LtcUtBenValueStream * FindNextValueStreamWithPropertyName(const char * sPropertyName);
+ LtcUtBenValueStream * FindValueStreamWithPropertyName(const char * sPropertyName);
+ std::vector<sal_uInt8> GetGraphicData(const char *pObjectName);
+
+ sal_uLong GetSize() const { return m_ulLength; }
+private: // Data
+ CUtOwningList cObjects;
+ CUtList cNamedObjects;
+ LwpSvStream * cpStream;
+ sal_uLong m_ulLength; // Added for TOCRead.cpp
+ BenObjectID cNextAvailObjectID; // for new object
+};
+
+class CBenObject : public CBenIDListElmt
+{
+public:
+ CBenProperty * UseProperty(BenObjectID PropertyID);
+ CBenValue * UseValue(BenObjectID PropertyID);
+ LtcBenContainer * GetContainer() { return cpContainer; }
+public: // Internal methods
+ CBenObject(LtcBenContainer * pContainer, BenObjectID ObjectID,
+ CUtListElmt * pPrev) : CBenIDListElmt(ObjectID, pPrev)
+ { cpContainer = pContainer; }
+ CUtList& GetProperties() { return cProperties; }
+
+private: // Data
+ LtcBenContainer * cpContainer;
+ CUtOwningList cProperties;
+};
+
+class CBenValue : public CBenIDListElmt
+{
+public:
+ size_t GetValueSize();
+ void ReadValueData(void * pBuffer,
+ size_t Offset, size_t MaxSize, size_t* pAmtRead);
+
+ CBenProperty * BEN_EXPORT GetProperty() { return cpProperty; }
+
+public: // Internal methods
+ // added to remove WARNING
+ explicit CBenValue(BenObjectID TypeID):CBenIDListElmt(TypeID)
+ {
+ cpProperty = nullptr;
+ }
+
+ void SetProperty(CBenProperty * pProperty)
+ {
+ cpProperty = pProperty;
+ }
+
+ inline CBenValueSegment * GetNextValueSegment(CBenValueSegment const *
+ pCurrValueSegment);
+ CUtList& GetValueSegments() { return cValueSegments; }
+
+private: // Data
+ CBenProperty * cpProperty;
+ CUtOwningList cValueSegments;
+};
+
+class CBenProperty : public CBenIDListElmt
+{
+public:
+ // In the Apple Bento, a property can have multiple values, each of a
+ // different type. But we never use it that way, so in this code a
+ // property has exactly one value
+
+ CBenValue& UseValue() { return cValue; }
+ CBenObject * GetBenObject() { return cpObject; }
+ LtcBenContainer * GetContainer() { return GetBenObject()->GetContainer(); }
+
+public: // Internal methods
+ // changed to remove WARNING here
+ CBenProperty(CBenObject * pObject, BenObjectID PropertyID,
+ BenObjectID TypeID, CUtListElmt * pPrevProperty) :
+ CBenIDListElmt(PropertyID, pPrevProperty), cValue(TypeID)
+ {
+ cpObject = pObject;
+ cValue.SetProperty(this);
+ }
+private: // Data
+ CBenObject * cpObject;
+ CBenValue cValue;
+};
+
+class CBenValueSegment : public CUtListElmt
+{
+public: // Internal methods
+ CBenValueSegment(CBenValue * pValue, BenContainerPos Pos,
+ size_t Size) : CUtListElmt(&pValue->GetValueSegments())
+ { cImmediate = false; cPos = Pos;
+ cSize = Size; }
+ CBenValueSegment(CBenValue * pValue, const void * pImmData,
+ unsigned short Size) : CUtListElmt(&pValue->GetValueSegments())
+ { cImmediate = true;
+ std::memcpy(cImmData, pImmData, Size); cSize = Size; }
+ bool IsImmediate() const { return cImmediate; }
+ BenContainerPos GetPosition() const { return cPos; }
+ size_t GetSize() const { return cSize; }
+ BenByte * GetImmediateData() { return cImmData; }
+
+private: // Data
+ bool cImmediate;
+ union
+ {
+ BenContainerPos cPos;
+ BenByte cImmData[4];
+ };
+ size_t cSize;
+};
+
+inline CBenValueSegment * CBenValue::GetNextValueSegment(CBenValueSegment const *
+ pCurrValueSegment)
+{ return static_cast<CBenValueSegment *>( cValueSegments.GetNextOrNULL(pCurrValueSegment) ); }
+
+
+class CBenNamedObject : public CBenObject
+{
+public: // Methods
+ virtual bool IsPropertyName();
+
+public: // Internal methods
+ CBenNamedObject(LtcBenContainer * pContainer, BenObjectID ObjectID,
+ CUtListElmt * pPrevObject, const OString& rName,
+ CUtListElmt * pPrevNamedObjectListElmt);
+
+ const OString& GetName() const { return csName; }
+
+private: // Data
+ OString csName;
+ CBenNamedObjectListElmt cNameListElmt;
+};
+
+class CBenPropertyName : public CBenNamedObject
+{
+public: // Internal methods
+ CBenPropertyName(LtcBenContainer * pContainer, BenObjectID ObjectID,
+ CUtListElmt * pPrevObject, const OString& rName,
+ CUtListElmt * pPrevNamedObjectListElmt) :
+ CBenNamedObject(pContainer, ObjectID, pPrevObject, rName,
+ pPrevNamedObjectListElmt) { ; }
+ virtual bool IsPropertyName() override;
+};
+
+class CBenTypeName : public CBenNamedObject
+{
+public: // Internal methods
+ CBenTypeName(LtcBenContainer * pContainer, BenObjectID ObjectID,
+ CUtListElmt * pPrevObject, const OString& rName,
+ CUtListElmt * pPrevNamedObjectListElmt) :
+ CBenNamedObject(pContainer, ObjectID, pPrevObject, rName,
+ pPrevNamedObjectListElmt) { ; }
+};
+
+} // end namespace OpenStormBento
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/bentoid.hxx b/lotuswordpro/source/filter/bentoid.hxx
new file mode 100644
index 000000000..cb3d9fb27
--- /dev/null
+++ b/lotuswordpro/source/filter/bentoid.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_BENTOID_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_BENTOID_HXX
+
+namespace OpenStormBento
+{
+#define BEN_OBJID_TOC 1 // TOC object ID
+#define BEN_PROPID_TOC_SEED 2 // TOC object starting seed
+#define BEN_TYPEID_TOC_TYPE 19 // TOC object property value type
+#define BEN_TYPEID_7_BIT_ASCII 21 // 7-bit ASCII
+#define BEN_PROPID_GLOBAL_TYPE_NAME 23 // Global type name
+#define BEN_PROPID_GLOBAL_PROPERTY_NAME 24 // Global property name
+#define BEN_PROPID_OBJ_REFERENCES 31 // Referenced objects from an object
+
+#define BEN_NEW_OBJECT 1 // object + property + type
+#define BEN_NEW_PROPERTY 2 // property + type
+#define BEN_NEW_TYPE 3 // type
+#define BEN_EXPLICIT_GEN 4 // generation
+
+#define BEN_SEGMENT_CODE_START 5
+#define BEN_OFFSET4_LEN4 5 // 4-byte offset + 4-byte length
+#define BEN_CONT_OFFSET4_LEN4 6 // continued 4-byte offset + 4-byte length
+#define BEN_OFFSET8_LEN4 7 // 8-byte offset + 4-byte length
+#define BEN_CONT_OFFSET8_LEN4 8 // continued 8-byte offset + 4-byte length
+#define BEN_IMMEDIATE0 9 // immediate (length = 0)
+#define BEN_IMMEDIATE1 10 // immediate (length = 1)
+#define BEN_IMMEDIATE2 11 // immediate (length = 2)
+#define BEN_IMMEDIATE3 12 // immediate (length = 3)
+#define BEN_IMMEDIATE4 13 // immediate (length = 4)
+#define BEN_CONT_IMMEDIATE4 14 // continued immediate (length = 4)
+#define BEN_SEGMENT_CODE_END 14
+
+#define BEN_REFERENCE_LIST_ID 15 // references recording object ID
+#define BEN_END_OF_BUFFER 24 // end of current buffer, go to next
+#define BEN_READ_PAST_END_OF_TOC 50 // Our code
+#define BEN_NOOP 0xFF
+
+} // end OpenStormBento namespace
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/benval.cxx b/lotuswordpro/source/filter/benval.cxx
new file mode 100644
index 000000000..2d93626ec
--- /dev/null
+++ b/lotuswordpro/source/filter/benval.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <sal/config.h>
+
+#include <algorithm>
+#include <cstring>
+
+#include "first.hxx"
+#include <assert.h>
+namespace OpenStormBento
+{
+
+size_t
+CBenValue::GetValueSize()
+{
+ size_t Size = 0;
+ CBenValueSegment * pCurr = nullptr;
+ while ((pCurr = GetNextValueSegment(pCurr)) != nullptr)
+ Size += pCurr->GetSize();
+ return Size;
+}
+
+void
+CBenValue::ReadValueData(void * pReadBuffer, size_t Offset,
+ size_t Amt, size_t* pAmtRead)
+{
+ size_t SegOffset = 0;
+ *pAmtRead = 0;
+ CBenValueSegment * pCurrSeg = nullptr;
+ LtcBenContainer * pContainer = GetProperty()->GetContainer();
+ BenByte* pBuffer = static_cast<BenByte*>(pReadBuffer);
+
+ /// pReadBuffer -- pointer to buffer of read result, allocated outside this function
+ /// Offset -- read buffer's start offset address, relative value in the whole value stream
+ /// Amt -- read buffer's size
+ /// pAmtRead -- return the actual read size
+
+ /// SegOffset -- current segment's start address offset, relative value in the whole value stream
+
+ while ((pCurrSeg = GetNextValueSegment(pCurrSeg)) != nullptr)
+ {
+ if (Amt == 0) /// whole buffer is full now, so return
+ return;
+
+ if (SegOffset <= Offset && Offset < SegOffset + pCurrSeg->GetSize()) /// begin at current segment
+ {
+ size_t OffsetIntoSeg = Offset - SegOffset; /// relative value in this value segment stream
+
+ size_t AmtThisSeg = std::min(Amt, pCurrSeg->GetSize() -
+ OffsetIntoSeg); /// size read in this segment, it's minimal value between Amt &
+ /// remain part from OffsetIntoSeg to the end of this segment
+
+ size_t AmtReadThisSeg; /// actual read size in this segment
+ if (pCurrSeg->IsImmediate())
+ {
+ std::memcpy(pBuffer, pCurrSeg->GetImmediateData() +
+ OffsetIntoSeg, AmtThisSeg);
+ AmtReadThisSeg = AmtThisSeg;
+ }
+ else
+ {
+ pContainer->SeekToPosition(pCurrSeg->GetPosition() +
+ OffsetIntoSeg);
+ pContainer->Read(pBuffer, AmtThisSeg, &AmtReadThisSeg);
+ }
+
+ *pAmtRead += AmtReadThisSeg;
+
+ if (AmtThisSeg != AmtReadThisSeg)
+ return;
+
+ pBuffer += AmtReadThisSeg;
+ Offset += AmtReadThisSeg;
+ Amt -= AmtReadThisSeg;
+ }
+
+ SegOffset += pCurrSeg->GetSize();
+ }
+}
+
+}//end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/clone.hxx b/lotuswordpro/source/filter/clone.hxx
new file mode 100644
index 000000000..a6747c005
--- /dev/null
+++ b/lotuswordpro/source/filter/clone.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_CLONE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_CLONE_HXX
+
+namespace detail
+{
+
+template<typename T>
+struct has_clone
+{
+ template<typename U, U x>
+ struct test;
+
+ typedef char yes;
+ typedef struct { char a[2]; } no;
+
+ template<typename U>
+ static yes& check_sig(U*, test<U* (U::*)() const, &U::clone>* = nullptr);
+ template<typename U>
+ static no& check_sig(...);
+
+ enum
+ {
+ value = sizeof(check_sig<T>(0)) == sizeof(yes)
+ };
+};
+
+template<typename T, bool HasClone>
+struct cloner
+{
+ static T* clone(T* const other)
+ {
+ return new T(*other);
+ }
+};
+
+template<typename T>
+struct cloner<T, true>
+{
+ static T* clone(T* const other)
+ {
+ return other->clone();
+ }
+};
+
+}
+
+/** Creates a new copy of the passed object.
+ If other is 0, just returns 0. Otherwise, if other has function
+ named clone with signature T* (T::*)() const, the function is called.
+ Otherwise, copy constructor is used.
+
+ @returns 0 or newly allocated object
+ */
+template<typename T>
+T* clone(T* const other)
+{
+ return other ? ::detail::cloner<T, ::detail::has_clone<T>::value>::clone(other) : 0;
+}
+
+#endif // INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_CLONE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx
new file mode 100644
index 000000000..017bd4761
--- /dev/null
+++ b/lotuswordpro/source/filter/explode.cxx
@@ -0,0 +1,509 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "explode.hxx"
+#include <tools/stream.hxx>
+
+#include <algorithm>
+#include <assert.h>
+#include <math.h>
+
+ const static char Tree1String[][32] = {
+ "101",
+ "11",
+ "100",
+ "011",
+ "0101",
+ "0100",
+ "0011",
+ "00101",
+ "00100",
+ "00011",
+ "00010",
+ "000011",
+ "000010",
+ "000001",
+ "0000001",
+ "0000000",
+ };
+
+ const static char Tree2String[][32] = {
+ "11" ,
+ "1011" ,
+ "1010" ,
+ "10011" ,
+ "10010" ,
+ "10001" ,
+ "10000" ,
+ "011111" ,
+ "011110" ,
+ "011101" ,
+ "011100" ,
+ "011011" ,
+ "011010" ,
+ "011001" ,
+ "011000" ,
+ "010111" ,
+ "010110" ,
+ "010101" ,
+ "010100" ,
+ "010011" ,
+ "010010" ,
+ "010001" ,
+ "0100001" ,
+ "0100000" ,
+ "0011111" ,
+ "0011110" ,
+ "0011101" ,
+ "0011100" ,
+ "0011011" ,
+ "0011010" ,
+ "0011001" ,
+ "0011000" ,
+ "0010111" ,
+ "0010110" ,
+ "0010101" ,
+ "0010100" ,
+ "0010011" ,
+ "0010010" ,
+ "0010001" ,
+ "0010000" ,
+ "0001111" ,
+ "0001110" ,
+ "0001101" ,
+ "0001100" ,
+ "0001011" ,
+ "0001010" ,
+ "0001001" ,
+ "0001000" ,
+ "00001111",
+ "00001110",
+ "00001101",
+ "00001100",
+ "00001011",
+ "00001010",
+ "00001001",
+ "00001000",
+ "00000111",
+ "00000110",
+ "00000101",
+ "00000100",
+ "00000011",
+ "00000010",
+ "00000001",
+ "00000000",
+ };
+
+Decompression::Decompression(SvStream * pInStream, SvStream * pOutStream)
+ : m_pInStream(pInStream)
+ , m_pOutStream(pOutStream)
+ , m_nCurrent4Byte(0)
+ , m_nBitsLeft(0)
+ , m_pBuffer(m_Buffer)
+ , m_nBytesLeft(0)
+ , m_nOutputBufferPos(0)
+{
+ if (!m_pInStream || !m_pOutStream )
+ {
+ assert(false);
+ }
+ ConstructTree1();
+ ConstructTree2();
+ fillArray();
+}
+/**
+ * @descr read specified bits from input stream
+ * @argument iCount - number of bits to be read, less than 31
+ * @argument nBits - bits read
+ * @return 0 - read OK, otherwise error
+ */
+sal_uInt32 Decompression::ReadBits(sal_uInt16 iCount, sal_uInt32 & nBits)
+{
+ if ( (iCount == 0) || (iCount > 31 ) )
+ {
+ return 1;
+ }
+
+ /* load at least need bits into val */
+ sal_uInt32 val = m_nCurrent4Byte; /* bit accumulator */
+ while (m_nBitsLeft < iCount)
+ {
+ if (m_nBytesLeft == 0)
+ {
+ m_nBytesLeft = m_pInStream->ReadBytes(m_Buffer, CHUNK);
+ m_pBuffer = m_Buffer;
+ if (m_nBytesLeft == 0) return 1;
+ }
+ val |= static_cast<sal_uInt32>(*m_pBuffer++) << m_nBitsLeft; /* load eight bits */
+ m_nBytesLeft --;
+ m_nBitsLeft += 8;
+ }
+
+ /* drop need bits and update buffer, always zero to seven bits left */
+ m_nCurrent4Byte = val >> iCount;
+ m_nBitsLeft -= iCount;
+
+ /* return need bits, zeroing the bits above that */
+ nBits = val & ((1 << iCount) - 1);
+
+ return 0;
+}
+/**
+ * @descr decompress input and write output
+ * @return 0 - read OK, otherwise error
+ */
+sal_Int32 Decompression::explode()
+{
+ /* The first 2 bytes are parameters */
+ sal_uInt32 P1;
+ if (0 != ReadBits(8, P1))/* 0 or 1 */
+ return -1;
+
+ /* I think this means 0=binary and 1=ascii file, but in RESOURCEs I saw always 0 */
+ if (P1 >= 1) // changed per 's review comments
+ return -1;
+
+ sal_uInt32 P2;
+ if (0 != ReadBits(8, P2))
+ return -1;
+
+ /* must be 4,5 or 6 and it is a parameter for the decompression algorithm */
+ if (P2 < 4 || P2 > 6)
+ return -2;
+
+ m_nOutputBufferPos = 0;
+ /* Now, a bit stream follows, which is decoded as described below: */
+ /* The algorithm terminates as soon as it runs out of bits. */
+ while(true)
+ {
+ // read 1 bit (take bits from the lowest value (LSB) to the MSB i.e. bit 0, bit 1 etc ...)
+ sal_uInt32 iBit;
+ if (0 != ReadBits(1, iBit))
+ break;
+ if ( 0 == (iBit & 0x01) )
+ {
+ //if the bit is 0 read 8 bits and write it to the output as it is.
+ sal_uInt32 symbol;
+ if (0 != ReadBits(8, symbol))
+ break;
+ m_Output[m_nOutputBufferPos++] = static_cast<sal_uInt8>(symbol);
+ if (m_nOutputBufferPos == MAXWIN)
+ {
+ m_pOutStream->WriteBytes(m_Output, m_nOutputBufferPos);
+ m_nOutputBufferPos = 0;
+ }
+ continue;
+ }
+ // if the bit is 1 we have here a length/distance pair:
+ // -decode a number with Hufmman Tree #1; variable bit length, result is 0x00 .. 0x0F -> L1
+ sal_uInt32 L1 = Decode(m_Tree1.get());
+ sal_uInt32 Length;
+ if (L1 <= 7)
+ {
+ //if L1 <= 7:
+ // LENGTH = L1 + 2
+ Length = L1 + 2;
+ }
+ else
+ {
+ // if L1 > 7
+ // read more (L1-7) bits -> L2
+ // LENGTH = L2 + M[L1-7] + 2
+ sal_uInt32 L2;
+ if (0 != ReadBits(static_cast<sal_uInt16>(L1 - 7), L2))
+ break;
+ Length = L2 + 2 + m_iArrayOfM[L1 -7];
+ }
+ if (Length == 519)
+ {
+ // end of compressed data
+ break;
+ }
+
+ // - decode another number with Hufmann Tree #2 giving result 0x00..0x3F -> D1
+ sal_uInt32 D1 = Decode(m_Tree2.get());
+ sal_uInt32 D2;
+ if (Length == 2)
+ {
+ // if LENGTH == 2
+ // D1 = D1 << 2
+ // read 2 bits -> D2
+ D1 = D1 << 2;
+ if (0 != ReadBits(2, D2))
+ break;
+ }
+ else
+ {
+ // else
+ // D1 = D1 << P2 // the parameter 2
+ // read P2 bits -> D2
+ D1 = D1 << P2;
+ if (0 != ReadBits(static_cast<sal_uInt16>(P2), D2))
+ break;
+ }
+ // DISTANCE = (D1 | D2) + 1
+ sal_uInt32 distance = (D1 | D2) + 1;
+
+ // - now copy LENGTH bytes from (output_ptr-DISTANCE) to output_ptr
+ // write current buffer to output
+ m_pOutStream->WriteBytes(m_Output, m_nOutputBufferPos);
+ m_nOutputBufferPos = 0;
+
+ // remember current position
+ sal_uInt32 nOutputPos = m_pOutStream->Tell();
+ if (distance > nOutputPos)
+ return -3; // format error
+
+ m_pOutStream->Flush();
+ // point back to copy position and read bytes
+ m_pOutStream->SeekRel(-static_cast<long>(distance));
+ sal_uInt8 sTemp[MAXWIN];
+ sal_uInt32 nRead = std::min(distance, Length);
+ m_pOutStream->ReadBytes(sTemp, nRead);
+ if (nRead != Length)
+ {
+ // fill the buffer with read content repeatedly until full
+ for (sal_uInt32 i=nRead; i<Length; i++)
+ {
+ sTemp[i] = sTemp[i-nRead];
+ }
+ }
+
+ // restore output stream position
+ m_pOutStream->Seek(nOutputPos);
+
+ // write current buffer to output
+ m_pOutStream->WriteBytes(sTemp, Length);
+ }
+ return 0;
+}
+/**
+ * @descr bits to string
+ * @return
+ */
+void Decompression::ToString(sal_uInt32 nBits, char *pChar, sal_uInt32 nLen)
+{
+ sal_uInt32 nBit;
+ for (sal_uInt32 i=nLen; i > 0; i--)
+ {
+ nBit = (nBits >> (i -1) ) & 0x01;
+ pChar[nLen - i] = nBit ? '1':'0';
+ }
+ pChar[nLen] = '\0';
+}
+
+/**
+ * @descr decode tree 1 for length
+ * @return the decoded value
+ */
+sal_uInt32 Decompression::Decode(HuffmanTreeNode * pRoot)
+{
+ sal_uInt32 nRet(0);
+ sal_uInt32 nRead, nReadAlready;
+
+ if( 0 != ReadBits(1, nReadAlready))
+ return 0; // something wrong
+
+ for (sal_uInt16 i=2; i <= 8; i++)
+ {
+ if ( 0 != ReadBits(1, nRead))
+ return 0; // something wrong
+
+ nReadAlready = (nReadAlready << 1) | (nRead & 0x01);
+
+ char sCode[16];
+ ToString(nReadAlready, sCode, i);
+ nRet = pRoot->QueryValue(sCode);
+ if (nRet != 0xffffffff)
+ {
+ break;
+ }
+ }
+ return nRet;
+}
+/**
+ * @descr construct tree 1 for length
+ * @return
+ */
+void Decompression::ConstructTree1()
+{ // Huffman Tree #1
+ // The first huffman tree (the Section called Decompression algorithm HUFFMAN) contains the length values. It is described by the following table:
+ // value (hex) code (binary)
+ // 0 101
+ // 1 11
+ // 2 100
+ // 3 011
+ // 4 0101
+ // 5 0100
+ // 6 0011
+ // 7 0010 1
+ // 8 0010 0
+ // 9 0001 1
+ // a 0001 0
+ // b 0000 11
+ // c 0000 10
+ // d 0000 01
+ // e 0000 001
+ // f 0000 000
+ m_Tree1.reset( new HuffmanTreeNode());
+ for (sal_uInt32 i=0; i< 16; i++)
+ {
+ m_Tree1->InsertNode(i, Tree1String[i]);
+ }
+ /*
+ m_Tree1->InsertNode(0, "101");
+ m_Tree1->InsertNode(1, "11");
+ m_Tree1->InsertNode(2, "100");
+ m_Tree1->InsertNode(3, "011");
+ m_Tree1->InsertNode(4, "0101");
+ m_Tree1->InsertNode(5, "0100");
+ m_Tree1->InsertNode(6, "0011");
+ m_Tree1->InsertNode(7, "00101");
+ m_Tree1->InsertNode(8, "00100");
+ m_Tree1->InsertNode(9, "00011");
+ m_Tree1->InsertNode(10, "00010");
+ m_Tree1->InsertNode(11, "000011");
+ m_Tree1->InsertNode(12, "000010");
+ m_Tree1->InsertNode(13, "000001");
+ m_Tree1->InsertNode(14, "0000001");
+ m_Tree1->InsertNode(15, "0000000");
+ */
+}
+/**
+ * @descr construct tree 2 for distance
+ * @return
+ */
+void Decompression::ConstructTree2()
+{
+
+ m_Tree2.reset(new HuffmanTreeNode());
+ for (sal_uInt32 i=0; i< 64; i++)
+ {
+ m_Tree2->InsertNode(i, Tree2String[i]);
+ }
+ //where bits should be read from the left to the right.
+}
+/**
+ * @descr
+ * @return
+ */
+void Decompression::fillArray()
+{
+ m_iArrayOfM[0] = 7;
+ for (int i=1; i < 16; i++)
+ {
+ m_iArrayOfM[i] = m_iArrayOfM[i - 1]+ static_cast<sal_uInt32>(pow(2.0, i-1));//2
+ }
+}
+
+HuffmanTreeNode::HuffmanTreeNode(sal_uInt32 nValue):value(nValue)
+{
+}
+HuffmanTreeNode::~HuffmanTreeNode()
+{
+}
+
+HuffmanTreeNode * HuffmanTreeNode::InsertNode(sal_uInt32 nValue, const char * pInCode)
+{
+ HuffmanTreeNode *pNew = new HuffmanTreeNode(nValue);
+ std::string aCode(pInCode);
+
+ // query its parents
+ const char cLast = aCode.back();
+ aCode.pop_back();
+ HuffmanTreeNode * pParent = QueryNode(aCode.c_str());
+ if (!pParent)
+ {
+ pParent = InsertNode(0xffffffff, aCode.c_str());
+ }
+ if (cLast == '0')
+ pParent->left.reset(pNew);
+ else // (cChar == '1')
+ pParent->right.reset(pNew);
+
+ return pNew;
+}
+
+HuffmanTreeNode * HuffmanTreeNode::QueryNode(const char * pCode)
+{
+ sal_uInt32 nLen = strlen(pCode);
+
+ HuffmanTreeNode * pNode = this; // this is the root
+ for(sal_uInt32 i=0; i<nLen && pNode; i++)
+ {
+ char cChar= pCode[i];
+ if (cChar == '0')
+ {
+ pNode = pNode->left.get();
+ }
+ else // (cChar == '1')
+ {
+ pNode = pNode->right.get();
+ }
+ }
+ return pNode;
+}
+
+sal_uInt32 HuffmanTreeNode::QueryValue(const char * pCode)
+{
+ HuffmanTreeNode * pNode =QueryNode(pCode);
+ if (pNode)
+ return pNode->value;
+
+ return 0xffffffff;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/explode.hxx b/lotuswordpro/source/filter/explode.hxx
new file mode 100644
index 000000000..95f45f2ef
--- /dev/null
+++ b/lotuswordpro/source/filter/explode.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_EXPLODE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_EXPLODE_HXX
+
+#include <sal/types.h>
+#include <memory>
+
+class SvStream;
+
+class HuffmanTreeNode
+{
+ std::unique_ptr<HuffmanTreeNode> left;
+ std::unique_ptr<HuffmanTreeNode> right;
+ sal_uInt32 value;
+public:
+ explicit HuffmanTreeNode(sal_uInt32 value = 0xffffffff) ;
+ ~HuffmanTreeNode() ;
+ HuffmanTreeNode * InsertNode(sal_uInt32 nValue, const char * pInCode);
+ HuffmanTreeNode * QueryNode(const char *pCode);
+ sal_uInt32 QueryValue(const char *pCode);
+};
+
+/**
+ * @brief
+ * define the function type for input read, output write
+ */
+#define CHUNK 16384
+#define MAXWIN 4096 /* maximum window size */
+class Decompression
+{
+public:
+ Decompression(SvStream * pInStream, SvStream * pOutStream);
+ /**
+ * @brief
+ * decompress from instream to outstream
+ */
+ sal_Int32 explode();
+ sal_uInt32 ReadBits(sal_uInt16 iCount, sal_uInt32 & nBits) ;
+ sal_uInt32 Decode(HuffmanTreeNode * pRoot);
+
+ /**
+ * @brief
+ * compressed/decompressed stream
+ */
+ SvStream *m_pInStream;
+ SvStream *m_pOutStream;
+
+ sal_uInt32 m_nCurrent4Byte; // bit buffer
+ sal_uInt32 m_nBitsLeft; // number of bits remained in bit buffer
+
+ sal_uInt8 m_Buffer[CHUNK]; // input byte buffer
+ sal_uInt8 *m_pBuffer; // pointer to input buffer
+ sal_uInt32 m_nBytesLeft; // number of bytes remained in byte buffer
+
+ sal_uInt8 m_Output[MAXWIN]; // output byte buffer
+ sal_uInt32 m_nOutputBufferPos; // pointer to output buffer
+
+ sal_uInt32 m_iArrayOfM[16];
+
+ std::unique_ptr<HuffmanTreeNode> m_Tree1, m_Tree2;
+
+ void ConstructTree1();
+ void ConstructTree2();
+ void fillArray();
+ static void ToString(sal_uInt32 nBits, char *pChar, sal_uInt32 nLen);
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/first.hxx b/lotuswordpro/source/filter/first.hxx
new file mode 100644
index 000000000..4a4f8fa67
--- /dev/null
+++ b/lotuswordpro/source/filter/first.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_FIRST_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_FIRST_HXX
+
+#include "bento.hxx"
+
+//#define ASSERT(cond) UT_ASSERT(cond)
+namespace OpenStormBento
+{
+// String constants
+extern const char gsBenMagicBytes[];
+
+CBenNamedObject * FindNamedObject(CUtList * pList, const OString& rName,
+ CUtListElmt ** ppPrev);
+
+CBenIDListElmt * FindID(CUtList * pList, BenObjectID ObjectID,
+ CUtListElmt ** ppPrev);
+} // end namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/localtime.cxx b/lotuswordpro/source/filter/localtime.cxx
new file mode 100644
index 000000000..9532cbbdc
--- /dev/null
+++ b/lotuswordpro/source/filter/localtime.cxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <localtime.hxx>
+#include <limits.h>
+#include <unicode/timezone.h>
+#include <memory>
+
+const long DAY_SEC =24 * 60 * 60;
+const long YEAR_SEC = 365 * DAY_SEC;
+const long FOURYEAR_SEC = 4 * YEAR_SEC + DAY_SEC;
+#ifndef LONG_MAX
+const long LONG_MAX=2147483647;
+#endif
+//01-01-70 was a Thursday
+const long BASE_DOW = 4;
+
+bool LtgGmTime(long rtime,LtTm& rtm)
+{
+ if (rtime < 0)
+ {
+ return false;
+ }
+ //is-current-year-a-leap-year flag
+ int islpyr = 0;
+
+ long tmptim;
+ long caltim = rtime;
+ tmptim = static_cast<long>(caltim / FOURYEAR_SEC);
+ caltim -= tmptim * FOURYEAR_SEC;
+
+ //Determine which year of the interval
+
+ // 1970, 1974, 1978,...,etc.
+ tmptim = (tmptim * 4) + 70;
+
+ if (caltim >= YEAR_SEC)
+ {
+ //1971, 1975, 1979,...,etc.
+ tmptim++;
+ caltim -= YEAR_SEC;
+
+ if ( caltim >= YEAR_SEC )
+ {
+ // 1972, 1976, 1980,...,etc.
+ tmptim++;
+ caltim -= YEAR_SEC;
+
+ //Note, it takes 366 days-worth of seconds to get past a leap year.
+ if (caltim >= (YEAR_SEC + DAY_SEC))
+ {
+ //1973, 1977, 1981,...,etc.
+ tmptim++;
+ caltim -= (YEAR_SEC + DAY_SEC);
+ }
+ else
+ {
+ //In a leap year after all, set the flag.
+ islpyr++;
+ }
+ }
+ }
+
+ //tmptim now holds the value for tm_year. caltim now holds the
+ //number of elapsed seconds since the beginning of that year.
+
+ rtm.tm_year = tmptim;
+
+ //Determine days since January 1 (0 - 365). This is the tm_yday value.
+ //Leave caltim with number of elapsed seconds in that day.
+
+ rtm.tm_yday = static_cast<long>(caltim / DAY_SEC);
+ caltim -= rtm.tm_yday * DAY_SEC;
+
+ //Determine months since January (0 - 11) and day of month (1 - 31)
+
+ long const * mdays;
+ if ( islpyr )
+ {
+ static long const lpdays[] =
+ {-1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
+ mdays = lpdays;
+ }
+ else
+ {
+ static long const days[] =
+ {-1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364};
+ mdays = days;
+ }
+
+ for ( tmptim = 1 ; mdays[tmptim] < rtm.tm_yday ; tmptim++ ) ;
+
+ rtm.tm_mon = --tmptim;
+
+ rtm.tm_mday = rtm.tm_yday - mdays[tmptim];
+
+ //Determine days since Sunday (0 - 6)
+
+ rtm.tm_wday = (static_cast<long>(rtime / DAY_SEC) + BASE_DOW) % 7;
+
+ //Determine hours since midnight (0 - 23), minutes after the hour
+ //(0 - 59), and seconds after the minute (0 - 59).
+
+ rtm.tm_hour = static_cast<long>(caltim / 3600);
+ caltim -= rtm.tm_hour * 3600;
+
+ rtm.tm_min = static_cast<long>(caltim / 60);
+ rtm.tm_sec = static_cast<long>(caltim - (rtm.tm_min) * 60);
+
+ //adjust year & month
+ rtm.tm_year += 1900;
+ ++(rtm.tm_mon);
+
+ return true;
+
+};
+bool LtgLocalTime(long rtime,LtTm& rtm)
+{
+ if (rtime < 0)
+ {
+ return false;
+ }
+
+ if ((rtime > 3 * DAY_SEC)&&(rtime < LONG_MAX - 3 * DAY_SEC))
+ {
+ std::unique_ptr<icu::TimeZone> pLocalZone(icu::TimeZone::createDefault());
+ long offset = (pLocalZone->getRawOffset())/1000;
+ pLocalZone.reset();
+ long ltime = rtime + offset;
+ return LtgGmTime(ltime,rtm);
+ }
+ return false;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx
new file mode 100644
index 000000000..e278fc8e1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwp9reader.cxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "lwp9reader.hxx"
+#include <lwpglobalmgr.hxx>
+#include "lwparrowstyles.hxx"
+#include <lwpobjhdr.hxx>
+#include "lwpdoc.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include <lwpdocdata.hxx>
+#include <lwpbookmarkmgr.hxx>
+#include <lwpchangemgr.hxx>
+#include <tools/stream.hxx>
+
+Lwp9Reader::Lwp9Reader (LwpSvStream* pInputStream, IXFStream* pStream)
+ : m_pDocStream(pInputStream)
+ , m_pStream(pStream)
+ , m_pObjMgr(nullptr)
+ , m_LwpFileHdr()
+{}
+
+/**
+ * @descr The entrance of Word Pro 9 import filter.
+ **/
+bool Lwp9Reader::Read()
+{
+ bool bRet = true;
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(m_pDocStream);
+ try
+ {
+ m_pObjMgr = pGlobal->GetLwpObjFactory();
+
+ //Does not support Word Pro 96 and previous versions
+ if (ReadFileHeader() && LwpFileHeader::m_nFileRevision>=0x000B)
+ {
+ ReadIndex();
+ bRet = ParseDocument();
+ }
+ else
+ bRet = false;
+ }
+ catch(...)
+ {
+ LwpGlobalMgr::DeleteInstance();
+ throw;
+ }
+ LwpGlobalMgr::DeleteInstance();
+ return bRet;
+}
+
+/**
+ * @descr Read the LWP7 object.
+ */
+bool Lwp9Reader::ReadFileHeader()
+{
+ if (!m_pDocStream->CheckSeek(LwpSvStream::LWP_STREAM_BASE))
+ return false;
+
+ //Remember to initialize the LwpFileHeader::m_nFileRevision first.
+ LwpFileHeader::m_nFileRevision = 0;
+
+ LwpObjectHeader objHdr;
+ objHdr.Read(*m_pDocStream);
+ sal_Int64 pos = m_pDocStream->Tell();
+ m_LwpFileHdr.Read(m_pDocStream);
+ return m_pDocStream->CheckSeek(pos + objHdr.GetSize());
+}
+
+/**
+ * @descr Read the index objects at the end of the WordProData stream
+ */
+void Lwp9Reader::ReadIndex()
+{
+ sal_Int64 oldpos = m_pDocStream->Tell();
+ sal_uInt32 rootoffset = m_LwpFileHdr.GetRootIndexOffset();
+ m_pDocStream->Seek(rootoffset + LwpSvStream::LWP_STREAM_BASE);
+ m_pObjMgr->ReadIndex(m_pDocStream);
+ m_pDocStream->Seek(oldpos);
+}
+
+/**
+ * @descr Parse all document content
+*/
+bool Lwp9Reader::ParseDocument()
+{
+ WriteDocHeader();
+
+ //Get root document
+ LwpDocument* doc = dynamic_cast<LwpDocument*> ( m_LwpFileHdr.GetDocID().obj().get() );
+
+ if (!doc)
+ return false;
+
+ //Parse Doc Data
+ LwpDocData *pDocData = dynamic_cast<LwpDocData*>(doc->GetDocData().obj().get());
+ if (pDocData!=nullptr)
+ pDocData->Parse(m_pStream);
+
+ //Register Styles
+ RegisteArrowStyles();
+ doc->DoRegisterStyle();
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->ToXml(m_pStream);
+
+ //Parse document content
+ m_pStream->GetAttrList()->Clear();
+ m_pStream->StartElement( "office:body" );
+
+ //Parse change list
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ pChangeMgr->ConvertAllChange(m_pStream);
+
+ doc->Parse(m_pStream);
+ m_pStream->EndElement("office:body");
+
+ WriteDocEnd();
+ return true;
+}
+
+/**
+ * @descr Write xml document header
+ */
+void Lwp9Reader::WriteDocHeader()
+{
+ m_pStream->StartDocument();
+
+ IXFAttrList *pAttrList = m_pStream->GetAttrList();
+
+ pAttrList->AddAttribute( "xmlns:office", "http://openoffice.org/2000/office" );
+ pAttrList->AddAttribute( "xmlns:style", "http://openoffice.org/2000/style" );
+ pAttrList->AddAttribute( "xmlns:text", "http://openoffice.org/2000/text" );
+ pAttrList->AddAttribute( "xmlns:table", "http://openoffice.org/2000/table" );
+ pAttrList->AddAttribute( "xmlns:draw", "http://openoffice.org/2000/drawing" );
+
+ pAttrList->AddAttribute( "xmlns:fo", "http://www.w3.org/1999/XSL/Format" );
+ pAttrList->AddAttribute( "xmlns:xlink", "http://www.w3.org/1999/xlink" );
+ pAttrList->AddAttribute( "xmlns:number", "http://openoffice.org/2000/datastyle" );
+ pAttrList->AddAttribute( "xmlns:svg", "http://www.w3.org/2000/svg" );
+ pAttrList->AddAttribute( "xmlns:chart", "http://openoffice.org/2000/chart" );
+
+ pAttrList->AddAttribute( "xmlns:dr3d", "http://openoffice.org/2000/dr3d" );
+ pAttrList->AddAttribute( "xmlns:math", "http://www.w3.org/1998/Math/MathML" );
+ pAttrList->AddAttribute( "xmlns:form", "http://openoffice.org/2000/form" );
+ pAttrList->AddAttribute( "xmlns:script", "http://openoffice.org/2000/script" );
+ pAttrList->AddAttribute( "xmlns:dc", "http://purl.org/dc/elements/1.1/" );
+
+ pAttrList->AddAttribute( "xmlns:meta", "http://openoffice.org/2000/meta" );
+ pAttrList->AddAttribute( "office:class", "text");
+ pAttrList->AddAttribute( "office:version", "1.0");
+
+ m_pStream->StartElement( "office:document" );
+ pAttrList->Clear();
+
+}
+/**
+ * @descr Write xml document end
+ */
+void Lwp9Reader::WriteDocEnd()
+{
+ m_pStream->EndElement("office:document");
+ m_pStream->EndDocument();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwp9reader.hxx b/lotuswordpro/source/filter/lwp9reader.hxx
new file mode 100644
index 000000000..bbbc551f8
--- /dev/null
+++ b/lotuswordpro/source/filter/lwp9reader.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWP9READER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWP9READER_HXX
+
+#include <config_lgpl.h>
+#include <lwpsvstream.hxx>
+#include <lwpfilehdr.hxx>
+#include <lwpobjfactory.hxx>
+#include <xfilter/ixfstream.hxx>
+
+/**
+ * @brief Reader framework class for Lotus Word Pro 9 file
+*/
+class Lwp9Reader final
+{
+public:
+ Lwp9Reader(LwpSvStream* InputStream, IXFStream* pStream);
+private:
+ LwpSvStream* m_pDocStream;
+ IXFStream* m_pStream;
+ LwpObjectFactory* m_pObjMgr;
+ LwpFileHeader m_LwpFileHdr; //LWP7 object
+ bool ReadFileHeader();
+ void ReadIndex();
+ bool ParseDocument();
+ void WriteDocHeader();
+ void WriteDocEnd();
+public:
+ bool Read();
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwparrowstyles.hxx b/lotuswordpro/source/filter/lwparrowstyles.hxx
new file mode 100644
index 000000000..55b0a3b14
--- /dev/null
+++ b/lotuswordpro/source/filter/lwparrowstyles.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPARROWSTYLES_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPARROWSTYLES_HXX
+
+#include <xfilter/xfarrowstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <lwpglobalmgr.hxx>
+
+/**
+ * @descr Register arrow styles that are not directly support by SODC.
+ * There are three kinds: reversed arrow, reversed concave arrow and reversed
+ * line arrow. This function should be called before the three arrows be used.
+ */
+void RegisteArrowStyles()
+{
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ if (!pXFStyleManager)
+ return;
+ //reversed arrow:
+ std::unique_ptr<XFArrowStyle> pArrowStyle100(new XFArrowStyle());
+ pArrowStyle100->SetArrowName("arrow100");
+ pArrowStyle100->SetViewbox("0 0 140 200");
+ pArrowStyle100->SetSVGPath("M0 180 L70 0 L140 180 L120 180 L70 30 L20 180 L0 180");
+ pXFStyleManager->AddStyle(std::move(pArrowStyle100));
+
+ //reversed arrow:
+ std::unique_ptr<XFArrowStyle> pArrowStyle1(new XFArrowStyle());
+ pArrowStyle1->SetArrowName("reverse arrow");
+ pArrowStyle1->SetViewbox("0 0 140 200");
+ pArrowStyle1->SetSVGPath("M0 0 L70 200 L140 0");
+ pXFStyleManager->AddStyle(std::move(pArrowStyle1));
+
+ //reversed concave arrow
+ std::unique_ptr<XFArrowStyle> pArrowStyle2(new XFArrowStyle());
+ pArrowStyle2->SetArrowName("reverse concave arrow");
+ pArrowStyle2->SetViewbox("0 0 140 200");
+ pArrowStyle2->SetSVGPath("M0 0 L80 200 L160 0 L80 100");
+ pXFStyleManager->AddStyle(std::move(pArrowStyle2));
+
+ //reversed line arrow
+ std::unique_ptr<XFArrowStyle> pArrowStyle3(new XFArrowStyle());
+ pArrowStyle3->SetArrowName("reverse line arrow");
+ pArrowStyle3->SetViewbox("0 0 140 200");
+ pArrowStyle3->SetSVGPath("M0 0 L70 200 L140 0L110 0 L70 160 L20 0 L0 0");
+ pXFStyleManager->AddStyle(std::move(pArrowStyle3));
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpatomholder.cxx b/lotuswordpro/source/filter/lwpatomholder.cxx
new file mode 100644
index 000000000..bd28e0b4d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpatomholder.cxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpatomholder.hxx>
+#include <lwptools.hxx>
+#include <osl/thread.h>
+#include <rtl/textenc.h>
+
+LwpAtomHolder::LwpAtomHolder()
+ : m_nAtom(0), m_nAssocAtom(0)
+{}
+
+/**
+ * @descr read atomholder from object stream
+ * the default encoding used in Word Pro is 1252
+*/
+void LwpAtomHolder::Read(LwpObjectStream *pStrm)
+{
+ //Referred to lwp: file40.cpp, QuickReadAtomHolder()
+
+ sal_uInt16 diskSize = pStrm->QuickReaduInt16();
+ sal_uInt16 len = pStrm->QuickReaduInt16();
+
+ if (len == 0 || diskSize < sizeof diskSize) {
+ m_nAtom = BAD_ATOM;
+ m_nAssocAtom = BAD_ATOM;
+ return;
+ }
+ m_nAtom = m_nAssocAtom = len;
+
+ LwpTools::QuickReadUnicode(pStrm, m_String, diskSize-sizeof(diskSize), RTL_TEXTENCODING_MS_1252);
+}
+/**
+ * @descr skip the atom holder in object stream
+*/
+void LwpAtomHolder::Skip(LwpObjectStream *pStrm)
+{
+ sal_uInt16 holdersize = pStrm->QuickReaduInt16();
+ pStrm->SeekRel(holdersize);
+ m_nAtom = m_nAssocAtom = BAD_ATOM;
+}
+/**
+ * @descr read path atom
+ * No use now for lwp filter, just skip the atom
+*/
+void LwpAtomHolder::ReadPathAtom(LwpObjectStream *pStrm)
+{
+ //Referred to lwp: file40.cpp, QuickReadPathAtom()
+ // TODO: Read the data. Now just skip it. The method to skip is same as above.
+ Skip(pStrm);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbackgroundoverride.cxx b/lotuswordpro/source/filter/lwpbackgroundoverride.cxx
new file mode 100644
index 000000000..4f3509dad
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbackgroundoverride.cxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "lwpbackgroundoverride.hxx"
+
+LwpBackgroundOverride::LwpBackgroundOverride(LwpBackgroundOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_aStuff(rOther.m_aStuff)
+{
+}
+
+LwpBackgroundOverride* LwpBackgroundOverride::clone() const
+{
+ return new LwpBackgroundOverride(*this);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbackgroundoverride.hxx b/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
new file mode 100644
index 000000000..6044d7eff
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBACKGROUNDOVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBACKGROUNDOVERRIDE_HXX
+
+#include <lwpoverride.hxx>
+#include "lwpbackgroundstuff.hxx"
+
+class LwpObjectStream;
+class LwpBackgroundOverride : public LwpOverride
+{
+public:
+ LwpBackgroundOverride() {}
+
+ virtual LwpBackgroundOverride* clone() const override;
+
+public:
+ virtual void Read(LwpObjectStream* pStrm) override
+ {
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+
+ m_aStuff.Read(pStrm);
+ }
+
+ pStrm->SkipExtra();
+ }
+
+ const LwpColor& GetBackColor() const { return m_aStuff.m_aFillColor; }
+ LwpBackgroundStuff& GetBGStuff() { return m_aStuff; }
+
+protected:
+ LwpBackgroundOverride(LwpBackgroundOverride const& rOther);
+
+private:
+ LwpBackgroundOverride& operator=(LwpBackgroundOverride const& rOther) = delete;
+
+private:
+ LwpBackgroundStuff m_aStuff;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
new file mode 100644
index 000000000..b139682f4
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype
+ * Implementation of class LwpBackgroundStuff.
+ */
+
+#include "lwpbackgroundstuff.hxx"
+#include "lwppttntbl.hxx"
+#include <xfilter/xfbgimage.hxx>
+
+#include <tools/stream.hxx>
+#include <vcl/dibtools.hxx>
+#include <vcl/BitmapTools.hxx>
+#include <svx/xbitmap.hxx>
+
+void LwpBackgroundStuff::Read(LwpObjectStream* pStrm)
+{
+ m_nID = pStrm->QuickReaduInt16();
+ m_aFillColor.Read(pStrm);
+ m_aPatternColor.Read(pStrm);
+ pStrm->SkipExtra();
+}
+
+void LwpBackgroundStuff::GetPattern(sal_uInt16 btPttnIndex, sal_uInt8 (&pPttnArray)[8])
+{
+ if (btPttnIndex > 71)
+ {
+ assert(false);
+ return;
+ }
+ assert((2 < btPttnIndex) && (btPttnIndex < 72));
+ const sal_uInt8* pTempArray = s_pLwpPatternTab[btPttnIndex];
+ for(sal_uInt8 i = 0; i < 8; i++)
+ {
+ pPttnArray[i] = pTempArray[7-i];
+ }
+}
+
+LwpColor* LwpBackgroundStuff::GetFillColor()
+{
+ if (m_nID == BACK_PATTERN)
+ {
+ return &m_aPatternColor;
+ }
+
+ return &m_aFillColor;
+}
+
+std::unique_ptr<XFBGImage> LwpBackgroundStuff::GetFillPattern()
+{
+ // not pattern fill?
+ if (!IsPatternFill())
+ {
+ return std::unique_ptr<XFBGImage>();
+ }
+
+ // get pattern array from pattern table
+ sal_uInt8 aPttnArray[8];
+ GetPattern(m_nID, aPttnArray);
+
+ // create bitmap object from the pattern array
+ BitmapEx aBmp = vcl::bitmap::CreateFromData( aPttnArray, 8, 8, 1, 1 );
+
+ // create XOBitmap object from bitmap object
+ XOBitmap aXOBitmap( aBmp );
+ aXOBitmap.Bitmap2Array();
+
+ // set back/fore-ground colors
+ if (m_aFillColor.IsValidColor() && m_aPatternColor.IsValidColor())
+ {
+ Color aBackColor(static_cast<sal_uInt8>(m_aFillColor.GetRed()),
+ static_cast<sal_uInt8>(m_aFillColor.GetGreen()),
+ static_cast<sal_uInt8>(m_aFillColor.GetBlue()));
+ Color aForeColor(static_cast<sal_uInt8>(m_aPatternColor.GetRed()),
+ static_cast<sal_uInt8>(m_aPatternColor.GetGreen()),
+ static_cast<sal_uInt8>(m_aPatternColor.GetBlue()));
+
+ if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
+ {
+ aXOBitmap.SetPixelColor( aBackColor );
+ aXOBitmap.SetBackgroundColor( aForeColor );
+ }
+ else
+ {
+ aXOBitmap.SetPixelColor( aForeColor );
+ aXOBitmap.SetBackgroundColor( aBackColor );
+ }
+ }
+
+ // transfer image data from XOBitmap->SvStream->BYTE-Array
+ SvMemoryStream aPicMemStream;
+ aXOBitmap.Array2Bitmap();
+ WriteDIB(aXOBitmap.GetBitmap(), aPicMemStream);
+ sal_uInt32 nSize = aPicMemStream.GetEndOfData();
+ std::unique_ptr<sal_uInt8[]> pImageBuff(new sal_uInt8 [nSize]);
+ memcpy(pImageBuff.get(), aPicMemStream.GetData(), nSize);
+
+ // create XFBGImage object.
+ std::unique_ptr<XFBGImage> xXFBGImage(new XFBGImage);
+ xXFBGImage->SetImageData(pImageBuff.get(), nSize);
+
+ pImageBuff.reset();
+
+ xXFBGImage->SetRepeate();
+
+ return xXFBGImage;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.hxx b/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
new file mode 100644
index 000000000..fb42e6e6d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Background object of Wordpro.
+************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBACKGROUNDSTUFF_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBACKGROUNDSTUFF_HXX
+#include <lwpcolor.hxx>
+#include "lwpstyledef.hxx"
+
+#include <memory>
+
+class XFBGImage;
+class LwpBackgroundStuff
+{
+public:
+ LwpBackgroundStuff() : m_nID(0)
+ {
+ }
+
+private:
+ static void GetPattern(sal_uInt16 btPttnIndex, sal_uInt8 (&pPttnArray)[8]);
+
+public:
+ void Read(LwpObjectStream *pStrm);
+ LwpColor* GetFillColor();
+ std::unique_ptr<XFBGImage> GetFillPattern();
+
+ bool IsTransparent() const { return (m_nID == BACK_TRANSPARENT); }
+ bool IsPatternFill() const { return (m_nID > 2 && m_nID < 72); }
+
+ friend class LwpBackgroundOverride;
+private:
+ sal_uInt16 m_nID;
+ LwpColor m_aFillColor;
+ LwpColor m_aPatternColor;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbasetype.cxx b/lotuswordpro/source/filter/lwpbasetype.cxx
new file mode 100644
index 000000000..9c5ab7f89
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbasetype.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpbasetype.hxx>
+/**
+ * @descr read PonoseNumber from object stream
+*/
+void LwpPanoseNumber::Read(LwpObjectStream *pStrm)
+{
+ m_nFamilyType = pStrm->QuickReaduInt8();
+ m_nSerifStyle = pStrm->QuickReaduInt8();
+ m_nWeight = pStrm->QuickReaduInt8();
+ m_nProportion = pStrm->QuickReaduInt8();
+ m_nContrast = pStrm->QuickReaduInt8();
+ m_nStrokeVariation = pStrm->QuickReaduInt8();
+ m_nArmStyle = pStrm->QuickReaduInt8();
+ m_nLetterform = pStrm->QuickReaduInt8();
+ m_nMidline = pStrm->QuickReaduInt8();
+ m_nXHeight = pStrm->QuickReaduInt8();
+
+}
+
+LwpPoint::LwpPoint()
+{
+ Reset();
+}
+
+/**
+ * @descr read point from object stream
+*/
+void LwpPoint::Read(LwpObjectStream *pStrm)
+{
+ m_nX = pStrm->QuickReadInt32();
+ m_nY = pStrm->QuickReadInt32();
+}
+/**
+ * @descr reset to zero
+*/
+void LwpPoint::Reset()
+{
+ m_nX=0;
+ m_nY=0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx
new file mode 100644
index 000000000..7e57cb59b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpbookmarkmgr.hxx>
+
+void LwpBookmarkMgr::AddXFBookmarkStart(const OUString& sName, XFBookmarkStart* pMark)
+{
+ auto iter = m_MapStart.find(sName);
+ if (iter == m_MapStart.end()) //not find
+ {
+ m_MapStart[sName] = pMark;
+ }
+ else //have exist the same bookmark name
+ {
+ auto xFind = iter->second;
+ OUString totalName = xFind->GetDivision() + ":" + xFind->GetName();
+ xFind->SetName(totalName);
+ m_MapStart[totalName] = xFind;
+ m_MapStart[sName] = pMark;
+ }
+}
+void LwpBookmarkMgr::AddXFBookmarkEnd(const OUString& sName, XFBookmarkEnd* pMark)
+{
+ auto iter = m_MapEnd.find(sName);
+ if (iter == m_MapEnd.end()) //not find
+ {
+ m_MapEnd[sName] = pMark;
+ }
+ else //have exist the same bookmark name
+ {
+ auto xFind = iter->second;
+ OUString totalName = xFind->GetDivision() + ":" + xFind->GetName();
+ xFind->SetName(totalName);
+ m_MapEnd[totalName] = xFind;
+ m_MapEnd[sName] = pMark;
+ }
+}
+bool LwpBookmarkMgr::FindBookmark(const OUString& sName)
+{
+ auto iter = m_MapStart.find(sName);
+ return iter != m_MapStart.end();
+}
+
+LwpBookmarkMgr::LwpBookmarkMgr()
+{
+ m_MapStart.clear();
+ m_MapEnd.clear();
+}
+LwpBookmarkMgr::~LwpBookmarkMgr()
+{
+ m_MapStart.clear();
+ m_MapEnd.clear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpborderstuff.cxx b/lotuswordpro/source/filter/lwpborderstuff.cxx
new file mode 100644
index 000000000..d3aebcdab
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpborderstuff.cxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Border stuff of Wordpro.
+************************************************************************/
+#include "lwpborderstuff.hxx"
+#include "lwpstyledef.hxx"
+#include <lwpfilehdr.hxx>
+#include <lwptools.hxx>
+
+LwpBorderStuff::LwpBorderStuff()
+ : m_nSides(0), m_nValid(0),
+ m_nBorderGroupIDLeft(0),
+ m_nBorderGroupIDRight(0),
+ m_nBorderGroupIDTop(0),
+ m_nBorderGroupIDBottom(0),
+ m_nGroupIndent(0),
+ m_nWidthLeft(0),
+ m_nWidthTop(0),
+ m_nWidthRight(0),
+ m_nWidthBottom(0)
+{
+}
+
+void LwpBorderStuff::Read(LwpObjectStream *pStrm)
+{
+ m_nSides = pStrm->QuickReaduInt16();
+ if( m_nSides&LEFT )
+ {
+ m_nBorderGroupIDLeft = pStrm->QuickReaduInt16();
+ m_nWidthLeft = pStrm->QuickReadInt32();
+ m_aColorLeft.Read(pStrm);
+
+ if( LwpFileHeader::m_nFileRevision < 0x000b )
+ {
+ pStrm->SeekRel(8);
+ }
+ }
+
+ if( m_nSides&RIGHT )
+ {
+ m_nBorderGroupIDRight = pStrm->QuickReaduInt16();
+ m_nWidthRight = pStrm->QuickReadInt32();
+ m_aColorRight.Read(pStrm);
+
+ if( LwpFileHeader::m_nFileRevision < 0x000b )
+ {
+ pStrm->SeekRel(8);
+ }
+ }
+
+ if( m_nSides&TOP )
+ {
+ m_nBorderGroupIDTop = pStrm->QuickReaduInt16();
+ m_nWidthTop = pStrm->QuickReadInt32();
+ m_aColorTop.Read(pStrm);
+
+ if( LwpFileHeader::m_nFileRevision < 0x000b )
+ {
+ pStrm->SeekRel(8);
+ }
+ }
+
+ if( m_nSides&BOTTOM )
+ {
+ m_nBorderGroupIDBottom = pStrm->QuickReaduInt16();
+ m_nWidthBottom = pStrm->QuickReadInt32();
+ m_aColorBottom.Read(pStrm);
+
+ if( LwpFileHeader::m_nFileRevision < 0x000b )
+ {
+ pStrm->SeekRel(8);
+ }
+ }
+
+ m_nGroupIndent = pStrm->QuickReadInt32();
+ m_nValid = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x0010 )
+ return;
+
+ if( m_nBorderGroupIDLeft&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDLeft = BGRP_SOLID;
+ }
+ if( m_nBorderGroupIDRight&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDRight = BGRP_SOLID;
+ }
+ if( m_nBorderGroupIDTop&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDTop = BGRP_SOLID;
+ }
+ if( m_nBorderGroupIDBottom&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDBottom = BGRP_SOLID;
+ }
+}
+
+bool LwpBorderStuff::HasSide(sal_uInt16 side)
+{
+ return (m_nSides & side) != 0;
+}
+
+sal_uInt16 LwpBorderStuff::GetSideType(sal_uInt16 side)
+{
+ switch(side)
+ {
+ case LEFT:
+ return m_nBorderGroupIDLeft;
+ case RIGHT:
+ return m_nBorderGroupIDRight;
+ case TOP:
+ return m_nBorderGroupIDTop;
+ case BOTTOM:
+ return m_nBorderGroupIDBottom;
+ }
+ // FIXME: this is needed to avoid warning: control reaches end of non-void function
+ // a better solution would be to enum value for the parameter side
+ return 0;
+}
+
+LwpColor LwpBorderStuff::GetSideColor(sal_uInt16 side)
+{
+ switch(side)
+ {
+ case LEFT:
+ return m_aColorLeft;
+ case RIGHT:
+ return m_aColorRight;
+ case TOP:
+ return m_aColorTop;
+ case BOTTOM:
+ return m_aColorBottom;
+ }
+ // FIXME: this is needed to avoid warning: control reaches end of non-void function
+ // a better solution would be to enum value for the parameter side
+ return LwpColor();
+}
+
+float LwpBorderStuff::GetSideWidth(sal_uInt16 side)
+{
+ switch(side)
+ {
+ case LEFT:
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nWidthLeft));
+ case RIGHT:
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nWidthRight));
+ case TOP:
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nWidthTop));
+ case BOTTOM:
+ return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nWidthBottom));
+ }
+ // FIXME: this is needed to avoid warning: control reaches end of non-void function
+ // a better solution would be to enum value for the parameter side
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpborderstuff.hxx b/lotuswordpro/source/filter/lwpborderstuff.hxx
new file mode 100644
index 000000000..4a7da6ce2
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpborderstuff.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Border stuff of Wordpro.
+************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBORDERSTUFF_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBORDERSTUFF_HXX
+
+#include <lwpcolor.hxx>
+
+class LwpBorderStuff
+{
+public:
+ LwpBorderStuff();
+
+ enum BorderType
+ {
+ NOSIDE = 0,
+ LEFT = 1,
+ RIGHT = 2,
+ TOP = 4,
+ BOTTOM = 8,
+ ALLSIDE = 15,
+ TEMPORARY = 0xff00
+ };
+
+public:
+ void Read(LwpObjectStream *pStrm);
+
+ sal_uInt16 GetSide() const { return m_nSides; }
+ bool HasSide(sal_uInt16 side);
+ sal_uInt16 GetSideType(sal_uInt16 side);
+ LwpColor GetSideColor(sal_uInt16 side);
+ float GetSideWidth(sal_uInt16 side);
+ friend class LwpParaBorderOverride;
+private:
+ sal_uInt16 m_nSides;
+ sal_uInt16 m_nValid;
+
+ sal_uInt16 m_nBorderGroupIDLeft;
+ sal_uInt16 m_nBorderGroupIDRight;
+ sal_uInt16 m_nBorderGroupIDTop;
+ sal_uInt16 m_nBorderGroupIDBottom;
+
+ sal_Int32 m_nGroupIndent;
+
+ sal_Int32 m_nWidthLeft;
+ sal_Int32 m_nWidthTop;
+ sal_Int32 m_nWidthRight;
+ sal_Int32 m_nWidthBottom;
+
+ LwpColor m_aColorLeft;
+ LwpColor m_aColorRight;
+ LwpColor m_aColorTop;
+ LwpColor m_aColorBottom;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.cxx b/lotuswordpro/source/filter/lwpbreaksoverride.cxx
new file mode 100644
index 000000000..8ffb8ab25
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbreaksoverride.cxx
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Breaks override of Wordpro.
+************************************************************************/
+#include <memory>
+
+#include "clone.hxx"
+#include "lwpbreaksoverride.hxx"
+#include <lwpobjstrm.hxx>
+#include <lwpatomholder.hxx>
+
+LwpBreaksOverride::LwpBreaksOverride()
+ : m_pNextStyle( new LwpAtomHolder )
+{
+}
+
+LwpBreaksOverride::LwpBreaksOverride(LwpBreaksOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pNextStyle(::clone(rOther.m_pNextStyle.get()))
+{
+}
+
+LwpBreaksOverride::~LwpBreaksOverride()
+{
+}
+
+LwpBreaksOverride* LwpBreaksOverride::clone() const
+{
+ return new LwpBreaksOverride(*this);
+}
+
+void LwpBreaksOverride::Read(LwpObjectStream *pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+
+ m_pNextStyle->Read(pStrm);
+ }
+
+ pStrm->SkipExtra();
+}
+
+void LwpBreaksOverride::Override(LwpBreaksOverride* pOther)
+{
+ if (m_nApply & BO_PAGEBEFORE)
+ {
+ if (IsPageBreakBeforeOverridden())
+ {
+ pOther->OverridePageBreakBefore(IsPageBreakBefore());
+ }
+ else
+ {
+ pOther->RevertPageBreakBefore();
+ }
+ }
+ if (m_nApply & BO_PAGEAFTER)
+ {
+ if (IsPageBreakAfterOverridden())
+ {
+ pOther->OverridePageBreakAfter(IsPageBreakAfter());
+ }
+ else
+ {
+ pOther->RevertPageBreakAfter();
+ }
+ }
+ if (m_nApply & BO_KEEPTOGETHER)
+ {
+ if (IsPageBreakWithinOverridden())
+ {
+ pOther->OverridePageBreakWithin(IsPageBreakWithin());
+ }
+ else
+ {
+ pOther->RevertPageBreakWithin();
+ }
+ }
+ if (m_nApply & BO_COLBEFORE)
+ {
+ if (IsColumnBreakBeforeOverridden())
+ {
+ pOther->OverrideColumnBreakBefore(IsColumnBreakBefore());
+ }
+ else
+ {
+ pOther->RevertColumnBreakBefore();
+ }
+ }
+ if (m_nApply & BO_COLAFTER)
+ {
+ if (IsColumnBreakAfterOverridden())
+ {
+ pOther->OverrideColumnBreakAfter(IsColumnBreakAfter());
+ }
+ else
+ {
+ pOther->RevertColumnBreakAfter();
+ }
+ }
+ if (m_nApply & BO_KEEPPREV)
+ {
+ if (IsKeepWithPreviousOverridden())
+ {
+ pOther->OverrideKeepWithPrevious(IsKeepWithPrevious());
+ }
+ else
+ {
+ pOther->RevertKeepWithPrevious();
+ }
+ }
+ if (m_nApply & BO_KEEPNEXT)
+ {
+ if (IsKeepWithNextOverridden())
+ {
+ pOther->OverrideKeepWithNext(IsKeepWithNext());
+ }
+ else
+ {
+ pOther->RevertKeepWithNext();
+ }
+ }
+ if (m_nApply & BO_USENEXTSTYLE)
+ {
+ if (IsUseNextStyleOverridden())
+ {
+ pOther->OverrideUseNextStyle(IsUseNextStyle());
+ }
+ else
+ {
+ pOther->RevertUseNextStyle();
+ }
+ }
+}
+
+void LwpBreaksOverride::OverridePageBreakBefore(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_PAGEBEFORE, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_PAGEBEFORE, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverridePageBreakAfter(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_PAGEAFTER, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_PAGEAFTER, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverridePageBreakWithin(bool bVal)
+{
+ // Note the flipped logic
+ if(!bVal)
+ {
+ LwpOverride::Override(BO_KEEPTOGETHER, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_KEEPTOGETHER, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverrideColumnBreakBefore(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_COLBEFORE, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_COLBEFORE, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverrideColumnBreakAfter(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_COLAFTER, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_COLAFTER, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverrideKeepWithNext(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_KEEPNEXT, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_KEEPNEXT, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverrideKeepWithPrevious(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_KEEPPREV, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_KEEPPREV, STATE_OFF);
+ }
+}
+void LwpBreaksOverride::OverrideUseNextStyle(bool bVal)
+{
+ if(bVal)
+ {
+ LwpOverride::Override(BO_USENEXTSTYLE, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_USENEXTSTYLE, STATE_OFF);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.hxx b/lotuswordpro/source/filter/lwpbreaksoverride.hxx
new file mode 100644
index 000000000..70bc624d3
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbreaksoverride.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Breaks override of Wordpro.
+************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBREAKSOVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBREAKSOVERRIDE_HXX
+
+#include <memory>
+#include <lwpoverride.hxx>
+
+class LwpObjectStream;
+class LwpAtomHolder;
+class LwpBreaksOverride final : public LwpOverride
+{
+
+public:
+ LwpBreaksOverride();
+ virtual ~LwpBreaksOverride() override;
+
+ virtual LwpBreaksOverride* clone() const override;
+
+ enum
+ {
+ BO_PAGEBEFORE = 0x01, // page break before this style
+ BO_PAGEAFTER = 0x02, // page break after this style
+ BO_KEEPTOGETHER = 0x04,
+ BO_COLBEFORE = 0x08, // col break before this style
+ BO_COLAFTER = 0x10, // col break after this style
+ BO_KEEPPREV = 0x20, // not with-PAGE BEF, COL BEF or WITHIN
+ BO_KEEPNEXT = 0x40, // not with-PAGE AFT, COL AFT or WITHIN
+ BO_USENEXTSTYLE = 0x80, // use next style name
+ BO_NEXTSTYLE = 0x100 // next style name
+ };
+public:
+ virtual void Read(LwpObjectStream *pStrm) override;
+
+ void Override(LwpBreaksOverride* pOther);
+
+ inline bool IsPageBreakBefore() const;
+ inline bool IsPageBreakAfter() const;
+ inline bool IsPageBreakWithin() const;
+ inline bool IsColumnBreakBefore() const;
+ inline bool IsColumnBreakAfter() const;
+ inline bool IsKeepWithNext() const;
+ inline bool IsKeepWithPrevious() const;
+ inline bool IsUseNextStyle() const;
+
+ inline bool IsPageBreakBeforeOverridden() const;
+ inline bool IsPageBreakAfterOverridden() const;
+ inline bool IsPageBreakWithinOverridden() const;
+ inline bool IsColumnBreakBeforeOverridden() const;
+ inline bool IsColumnBreakAfterOverridden() const;
+ inline bool IsKeepWithNextOverridden() const;
+ inline bool IsKeepWithPreviousOverridden() const;
+ inline bool IsUseNextStyleOverridden() const;
+
+ inline void RevertPageBreakBefore();
+ inline void RevertPageBreakAfter();
+ inline void RevertPageBreakWithin();
+ inline void RevertColumnBreakBefore();
+ inline void RevertColumnBreakAfter();
+ inline void RevertKeepWithNext();
+ inline void RevertKeepWithPrevious();
+ inline void RevertUseNextStyle();
+
+ void OverridePageBreakBefore(bool bVal);
+ void OverridePageBreakAfter(bool bVal);
+ void OverridePageBreakWithin(bool bVal);
+ void OverrideColumnBreakBefore(bool bVal);
+ void OverrideColumnBreakAfter(bool bVal);
+ void OverrideKeepWithNext(bool bVal);
+ void OverrideKeepWithPrevious(bool bVal);
+ void OverrideUseNextStyle(bool bVal);
+
+private:
+ LwpBreaksOverride(LwpBreaksOverride const& rOther);
+ LwpBreaksOverride& operator=(const LwpBreaksOverride& rOther) = delete;
+
+ std::unique_ptr<LwpAtomHolder> m_pNextStyle;
+};
+
+inline bool LwpBreaksOverride::IsPageBreakBefore() const
+{
+ return ((m_nValues & BO_PAGEBEFORE) != 0);
+}
+
+inline bool LwpBreaksOverride::IsPageBreakAfter() const
+{
+ return ((m_nValues & BO_PAGEAFTER) != 0);
+}
+inline bool LwpBreaksOverride::IsPageBreakWithin() const
+{
+ return ((m_nValues & BO_KEEPTOGETHER) != 0);
+}
+inline bool LwpBreaksOverride::IsColumnBreakBefore() const
+{
+ return ((m_nValues & BO_COLBEFORE) != 0);
+}
+inline bool LwpBreaksOverride::IsColumnBreakAfter() const
+{
+ return ((m_nValues & BO_COLAFTER) != 0);
+}
+inline bool LwpBreaksOverride::IsKeepWithNext() const
+{
+ return ((m_nValues & BO_KEEPNEXT) != 0);
+}
+inline bool LwpBreaksOverride::IsKeepWithPrevious() const
+{
+ return ((m_nValues & BO_KEEPPREV) != 0);
+}
+inline bool LwpBreaksOverride::IsUseNextStyle() const
+{
+ return ((m_nValues & BO_USENEXTSTYLE) != 0);
+}
+
+inline bool LwpBreaksOverride::IsPageBreakBeforeOverridden() const
+{
+ return ((m_nOverride& BO_PAGEBEFORE) != 0);
+}
+inline bool LwpBreaksOverride::IsPageBreakAfterOverridden() const
+{
+ return ((m_nOverride& BO_PAGEAFTER) != 0);
+}
+inline bool LwpBreaksOverride::IsPageBreakWithinOverridden() const
+{
+ return ((m_nOverride& BO_KEEPTOGETHER) != 0);
+}
+inline bool LwpBreaksOverride::IsColumnBreakBeforeOverridden() const
+{
+ return ((m_nOverride& BO_COLBEFORE) != 0);
+}
+inline bool LwpBreaksOverride::IsColumnBreakAfterOverridden() const
+{
+ return ((m_nOverride& BO_COLAFTER) != 0);
+}
+inline bool LwpBreaksOverride::IsKeepWithNextOverridden() const
+{
+ return ((m_nOverride& BO_KEEPNEXT) != 0);
+}
+inline bool LwpBreaksOverride::IsKeepWithPreviousOverridden() const
+{
+ return ((m_nOverride& BO_KEEPPREV) != 0);
+}
+inline bool LwpBreaksOverride::IsUseNextStyleOverridden() const
+{
+ return ((m_nOverride& BO_USENEXTSTYLE) != 0);
+}
+
+inline void LwpBreaksOverride::RevertPageBreakBefore()
+{
+ LwpOverride::Override(BO_PAGEBEFORE, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertPageBreakAfter()
+{
+ LwpOverride::Override(BO_PAGEAFTER, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertPageBreakWithin()
+{
+ LwpOverride::Override(BO_KEEPTOGETHER, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertColumnBreakBefore()
+{
+ LwpOverride::Override(BO_COLBEFORE, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertColumnBreakAfter()
+{
+ LwpOverride::Override(BO_COLAFTER, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertKeepWithNext()
+{
+ LwpOverride::Override(BO_KEEPNEXT, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertKeepWithPrevious()
+{
+ LwpOverride::Override(BO_KEEPPREV, STATE_STYLE);
+}
+inline void LwpBreaksOverride::RevertUseNextStyle()
+{
+ LwpOverride::Override(BO_USENEXTSTYLE, STATE_STYLE);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
new file mode 100644
index 000000000..6f5b638c8
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpbulletstylemgr.hxx"
+#include "lwpfribheader.hxx"
+#include "lwpdoc.hxx"
+#include "lwpstory.hxx"
+#include "lwpdivinfo.hxx"
+#include "lwppara.hxx"
+#include "lwpsilverbullet.hxx"
+#include <lwptools.hxx>
+#include "lwpparaproperty.hxx"
+#include <xfilter/xfliststyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xflist.hxx>
+#include <lwpglobalmgr.hxx>
+#include <xfilter/xflistitem.hxx>
+#include <sal/log.hxx>
+
+LwpBulletStyleMgr::LwpBulletStyleMgr()
+ : m_pFoundry(nullptr)
+ , m_bContinue(true)
+ , m_bIsBulletSkipped(false)
+{
+}
+
+LwpBulletStyleMgr::~LwpBulletStyleMgr()
+{
+ m_vIDsPairList.clear();
+ m_vStyleNameList.clear();
+}
+
+/**
+ * @short Register bullet style to style-list. The function only register the bullet and single customized numbering
+ * not including the numbering sequence.
+ * @param pPara pointer to the current paragraph which has a bullet/numbering.
+ * @param pBullOver pointer to the bulletoverride of current paragraph.
+ * @param pIndent pointer to the indentoverride of current paragraph.
+ */
+OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, const LwpBulletOverride* pBullOver,
+ LwpIndentOverride const * pIndent)
+{
+ if(!pPara || !pIndent || !pBullOver)
+ {
+ return OUString();
+ }
+
+ LwpSilverBullet* pSilverBullet = pPara->GetSilverBullet();
+ if (!pSilverBullet)
+ {
+ assert(false);
+ return OUString();
+ }
+
+ LwpPara* pBulletPara = pSilverBullet->GetBulletPara();
+ if (!pBulletPara)
+ {
+ SAL_WARN("lwp", "missing bullet para");
+ return OUString();
+ }
+
+ LwpParaProperty* pProp = pPara->GetProperty(PP_LOCAL_INDENT);
+ LwpParaIndentProperty* pIndentProp = nullptr;
+ LwpObjectID aIndentID;
+ if (pProp)
+ {
+ pIndentProp = static_cast<LwpParaIndentProperty*>(pProp);
+ aIndentID = pIndentProp->GetIndentID();
+ }
+
+ LwpObjectID aBulletID = pBullOver->GetSilverBullet();
+ std::unique_ptr<LwpBulletOverride> pBulletOver(pBullOver->clone());
+
+ sal_uInt16 nNameIndex = 0;
+ for (auto const& vIDsPair : m_vIDsPairList)
+ {
+ if (vIDsPair.first->GetSilverBullet() == aBulletID && vIDsPair.second == aIndentID
+ && vIDsPair.first->IsRightAligned() == pBullOver->IsRightAligned())
+ {
+ return m_vStyleNameList[nNameIndex];
+ }
+ else
+ {
+ nNameIndex++;
+ }
+ }
+
+ m_vIDsPairList.emplace_back(std::move(pBulletOver), aIndentID);
+ OUString aStyleName;
+
+ LwpFribPtr& rBulletParaFribs = pBulletPara->GetFribs();
+ bool bIsNumbering = (rBulletParaFribs.HasFrib(FRIB_TAG_PARANUMBER) != nullptr);
+
+ enumXFAlignType eAlign = enumXFAlignStart;
+ if (pBullOver->IsRightAligned())
+ {
+ eAlign = enumXFAlignEnd;
+ }
+
+ std::unique_ptr<XFListStyle> pListStyle(new XFListStyle());
+ XFStyleManager* pXFStyleMgr = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+
+ if (!bIsNumbering)
+ {
+ for (sal_uInt8 nC = 1; nC < 11; nC++)
+ {
+ pListStyle->SetListBullet(nC, pSilverBullet->GetBulletChar(), pSilverBullet->GetBulletFontName(),
+ LwpSilverBullet::GetPrefix(), LwpSilverBullet::GetSuffix());
+
+ if (pIndent->GetMRest() > 0) /* note: used to be 0.001, no idea why */
+ {
+ pListStyle->SetListPosition(nC, 0.0,
+ LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(pIndent->GetMRest())), 0.0, eAlign);
+ }
+ else
+ {
+ pListStyle->SetListPosition(nC, 0.0,
+ 0.0, LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(pIndent->GetMFirst())), eAlign);
+ }
+ }
+
+ aStyleName = pXFStyleMgr->AddStyle(std::move(pListStyle)).m_pStyle->GetStyleName();
+ }
+ else
+ {
+ ParaNumbering aParaNumbering;
+ pBulletPara->GetParaNumber(1, &aParaNumbering);
+ LwpFribParaNumber* pParaNumber = aParaNumbering.pParaNumber;
+ if (pParaNumber)
+ {
+ for (sal_uInt8 nPos = 1; nPos < 10; nPos++)
+ {
+ if (pParaNumber->GetStyleID() != NUMCHAR_other)
+ {
+ OUString aPrefix;
+ XFNumFmt aFmt;
+ if (aParaNumbering.pPrefix)
+ {
+ aPrefix += aParaNumbering.pPrefix->GetText();
+ }
+
+ OUString aNumber = LwpSilverBullet::GetNumCharByStyleID(pParaNumber);
+ if (pParaNumber->GetStyleID() == NUMCHAR_01 || pParaNumber->GetStyleID() == NUMCHAR_Chinese4)
+ {
+ aPrefix += "0";
+ }
+ aFmt.SetPrefix(aPrefix);
+
+ aFmt.SetFormat(aNumber);
+
+ if (aParaNumbering.pSuffix)
+ {
+ aFmt.SetSuffix(aParaNumbering.pSuffix->GetText());
+ }
+
+ //set numbering format into the style-list.
+ pListStyle->SetListNumber(nPos, aFmt, pParaNumber->GetStart()+1);
+
+ }
+ else
+ {
+ OUString aPrefix, aSuffix;
+ if (aParaNumbering.pPrefix)
+ {
+ aPrefix = aParaNumbering.pPrefix->GetText();
+ }
+ if (aParaNumbering.pSuffix)
+ {
+ aSuffix = aParaNumbering.pSuffix->GetText();
+ }
+
+ pListStyle->SetListBullet(nPos, LwpSilverBullet::GetNumCharByStyleID(pParaNumber),
+ "Times New Roman", aPrefix, aSuffix);
+ }
+
+ pListStyle->SetListPosition(nPos, 0.0, 0.635, 0.0);
+ }
+ aStyleName = pXFStyleMgr->AddStyle(std::move(pListStyle)).m_pStyle->GetStyleName();
+ }
+ }
+
+ m_vStyleNameList.push_back(aStyleName);
+ return aStyleName;
+
+}
+
+//Create nested XFList and XFItems and then add it to XFContentContainer(pCont)
+//Return the inner XFItem created.
+rtl::Reference<XFContentContainer> LwpBulletStyleMgr::AddBulletList(
+ XFContentContainer* pCont, bool bIsOrdered,
+ const OUString& rStyleName, sal_Int16 nLevel, bool bIsBulletSkiped)
+{
+ assert(nLevel>0);
+
+ m_bIsBulletSkipped = bIsBulletSkiped;
+
+ //todo: need judge here.
+ bool bContinue = m_bContinue;
+
+ rtl::Reference<XFList> prevList;
+ XFListItem* theItem;
+ XFListItem* InnerItem = nullptr;
+ for (sal_Int8 nC = nLevel-1; nC >= 0; nC--)
+ {
+ rtl::Reference<XFList> theList(new XFList);
+ theItem = new XFListItem();
+ theList->Add(theItem);
+
+ if (bIsOrdered)
+ {
+ theList->SetOrdered(true);
+ }
+ else
+ {
+ bContinue = false;
+ theList->SetOrdered(false);
+ }
+
+ if (nC == nLevel-1)
+ {
+ theList->SetContinueNumber(bContinue);
+ }
+ //Add the outer list to pCont
+ if (nC == 0 && pCont)
+ {
+ theList->SetStyleName(rStyleName);
+ pCont->Add(theList.get());
+ }
+
+ if ((nC == nLevel-1) && bIsBulletSkiped)
+ {
+ theItem->SetIsHeader();
+
+ theList->SetContinueNumber(true);
+ }
+
+ if(nC == nLevel-1)
+ {
+ InnerItem = theItem;
+ }
+
+ if(prevList)
+ {
+ theItem->Add(prevList.get());
+ }
+ prevList = theList;
+ }
+ return InnerItem;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
new file mode 100644
index 000000000..c4dd9d6c3
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBULLETSTYLEMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPBULLETSTYLEMGR_HXX
+
+#include <memory>
+
+#include <config_lgpl.h>
+#include <lwpfoundry.hxx>
+#include <lwpobjid.hxx>
+#include <utility>
+#include <xfilter/xfcontentcontainer.hxx>
+
+class XFList;
+class LwpPara;
+class LwpIndentOverride;
+class LwpBulletOverride;
+
+class LwpBulletStyleMgr final
+{
+public:
+ LwpBulletStyleMgr();
+ ~LwpBulletStyleMgr();
+ OUString RegisterBulletStyle(LwpPara* pPara, const LwpBulletOverride* pBullOver,
+ LwpIndentOverride const * pIndent);
+ inline void SetFoundry(LwpFoundry* pFoundry);
+ inline void SetContinueFlag(bool bFlag);
+ rtl::Reference<XFContentContainer> AddBulletList(XFContentContainer* pCont, bool bIsOrdered,
+ const OUString& rStyleName, sal_Int16 nLevel, bool bIsBulletSkiped);
+ inline void SetCurrentSilverBullet(const LwpObjectID& rNewID);
+
+private:
+ typedef std::pair<std::unique_ptr<LwpBulletOverride>, LwpObjectID> OverridePair;
+ std::vector <OUString> m_vStyleNameList;
+ std::vector <OverridePair> m_vIDsPairList;
+ LwpFoundry* m_pFoundry;
+ bool m_bContinue;
+ bool m_bIsBulletSkipped;
+ LwpObjectID m_aCurrentNumberingID;
+};
+
+inline void LwpBulletStyleMgr::SetFoundry(LwpFoundry* pFoundry)
+{
+ m_pFoundry = pFoundry;
+}
+inline void LwpBulletStyleMgr::SetContinueFlag(bool bFlag)
+{
+ m_bContinue = bFlag;
+}
+inline void LwpBulletStyleMgr::SetCurrentSilverBullet(const LwpObjectID& rNewID)
+{
+ m_aCurrentNumberingID = rNewID;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
new file mode 100644
index 000000000..3fdcf3cac
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -0,0 +1,934 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - cell layouts
+ */
+
+#include <memory>
+#include "lwpcelllayout.hxx"
+#include <lwpfoundry.hxx>
+#include <lwpobjfactory.hxx>
+#include "lwptblcell.hxx"
+#include "lwptblformula.hxx"
+#include "lwpholder.hxx"
+#include "lwpnumericfmt.hxx"
+#include "lwptable.hxx"
+#include "lwprowlayout.hxx"
+#include <lwpfilehdr.hxx>
+#include <lwpglobalmgr.hxx>
+
+#include <sal/log.hxx>
+
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfcell.hxx>
+#include <xfilter/xfcellstyle.hxx>
+#include <xfilter/xfcolstyle.hxx>
+
+LwpCellLayout::LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpMiddleLayout(objHdr, pStrm)
+ , m_bConvertCell(false)
+ , crowid(0)
+ , ccolid(0)
+ , cType(LDT_NONE)
+{
+}
+
+LwpCellLayout::~LwpCellLayout()
+{}
+
+/**
+ * @short Get table layout pointer, if default cell layout, return NULL
+ * @param LwpTableLayout *
+ * @return
+ */
+LwpTableLayout * LwpCellLayout::GetTableLayout()
+{
+ LwpRowLayout * pRow = dynamic_cast<LwpRowLayout *>(GetParent().obj().get());
+ if(!pRow)
+ {
+ return nullptr;
+ }
+ LwpTableLayout * pTableLayout = pRow->GetParentTableLayout();
+ return pTableLayout;
+}
+/**
+ * @short Get table pointer, if default cell layout, return NULL
+ * @param LwpTable *
+ * @return
+ */
+LwpTable * LwpCellLayout::GetTable()
+{
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if(!pTableLayout)
+ {
+ return nullptr;
+ }
+ LwpTable *pTable = pTableLayout->GetTable();
+ return pTable;
+}
+/**
+ * @short Set current cell layout to cell layout map
+ * @param
+ * @return
+ */
+void LwpCellLayout::SetCellMap()
+{
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (pTableLayout)
+ pTableLayout->SetWordProCellMap(crowid, ccolid, this);
+}
+/**
+ * @short Get actual width of this cell layout
+ * @param
+ * @return width (cm)
+ */
+double LwpCellLayout::GetActualWidth()
+{
+ //Get table layout
+ LwpTableLayout * pTableLayout = GetTableLayout();
+
+ if (pTableLayout == nullptr)
+ {
+ return GetGeometryWidth();
+ }
+
+ OUString strColStyle = pTableLayout->GetColumnWidth(ccolid);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFColStyle *pStyle = static_cast<XFColStyle *>(pXFStyleManager->FindStyle(strColStyle));
+ if(pStyle)
+ {
+ return pStyle->GetWidth();
+ }
+
+ return GetGeometryWidth();
+}
+
+/**
+ * @short Apply padding to cell style
+ * @param pCellStyle - pointer of XFCellStyle
+ * @return
+ */
+void LwpCellLayout::ApplyPadding(XFCellStyle *pCellStyle)
+{
+ double fLeft = GetMarginsValue(MARGIN_LEFT);
+ double fRight = GetMarginsValue(MARGIN_RIGHT);
+ double fTop = GetMarginsValue(MARGIN_TOP);
+ double fBottom = GetMarginsValue(MARGIN_BOTTOM);
+ pCellStyle->SetPadding(static_cast<float>(fLeft),static_cast<float>(fRight),static_cast<float>(fTop),static_cast<float>(fBottom));
+}
+/**
+ * @short Apply border to cell style according to cell position, default cell layout won't use this function
+ * @param
+ * @return pCellStyle - pointer of XFCellStyle
+ */
+void LwpCellLayout::ApplyBorders(XFCellStyle *pCellStyle)
+{
+ // judge cell border type
+ LwpCellBorderType eType = GetCellBorderType(crowid, ccolid, GetTableLayout());
+
+ // get left cell and judge if neighbour border is different
+ std::unique_ptr<XFBorders> xBorders(GetXFBorders());
+ if (!xBorders)
+ {
+ return;
+ }
+
+ switch (eType)
+ {
+ case enumNoBottomBorder:
+ xBorders->SetWidth(enumXFBorderBottom, 0);
+ break;
+ case enumNoLeftBorder:
+ xBorders->SetWidth(enumXFBorderLeft, 0);
+ break;
+ case enumNoLeftNoBottomBorder:
+ xBorders->SetWidth(enumXFBorderBottom, 0);
+ xBorders->SetWidth(enumXFBorderLeft, 0);
+ break;
+ case enumWholeBorder:
+ break;
+ default:
+ assert(false);
+ }
+ pCellStyle->SetBorders(xBorders.release());
+}
+/**
+ * @short Apply watermark to cell style
+ * @param pCellStyle - pointer of XFCellStyle
+ * @return
+ */
+void LwpCellLayout::ApplyWatermark(XFCellStyle *pCellStyle)
+{
+ std::unique_ptr<XFBGImage> xBGImage(GetXFBGImage());
+ if (xBGImage)
+ {
+ pCellStyle->SetBackImage(xBGImage);
+ }
+}
+
+/**
+ * @short Apply pattern fill to cell style
+ * @param pCellStyle - pointer of XFCellStyle
+ * @return
+ */
+void LwpCellLayout::ApplyPatternFill(XFCellStyle* pCellStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetFillPattern());
+ if (xXFBGImage)
+ {
+ pCellStyle->SetBackImage(xXFBGImage);
+ }
+}
+
+/**
+ * @short Apply background to cell style
+ * @param pCellStyle - pointer of XFCellStyle
+ * @return
+ */
+void LwpCellLayout::ApplyBackGround(XFCellStyle* pCellStyle)
+{
+ if (IsPatternFill())
+ {
+ ApplyPatternFill(pCellStyle);
+ }
+ else
+ {
+ ApplyBackColor(pCellStyle);
+ }
+}
+/**
+ * @short Apply back color to cell style
+ * @param pCellStyle - pointer of XFCellStyle
+ * @return
+ */
+void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle)
+{
+ LwpColor* pColor = GetBackColor();
+ if(pColor && pColor->IsValidColor())
+ {
+ XFColor aXFColor(pColor->To24Color());
+ pCellStyle->SetBackColor(aXFColor);
+ }
+}
+/**
+ * @short register style of cell layout
+ * @param pCellStyle The style of the cell, which would be applied to the cell.
+ * @return
+ */
+void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
+{
+ LwpLayoutNumerics* pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(cLayNumerics.obj().get());
+ if (!pLayoutNumerics)
+ {
+ // if current layout doesn't have format, go to based on layout
+ LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(GetBasedOnStyle().get());
+ if (pCellLayout)
+ {
+ pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get());
+ }
+ }
+
+ // apply format style
+ if (pLayoutNumerics)
+ {
+ XFStyle* pStyle = pLayoutNumerics->Convert();
+ if (pStyle)
+ {
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_NumfmtName = pXFStyleManager->AddStyle(std::unique_ptr<XFStyle>(pStyle)).m_pStyle->GetStyleName();
+ pCellStyle->SetDataStyle(m_NumfmtName);
+ }
+ }
+}
+/**
+ * @short get style name according to cell position, only table default cells use this function
+ * @param nRow - default cell position row number
+ * @param nCol - default cell position col number
+ * @return OUString - registered cell style name
+ */
+OUString const & LwpCellLayout::GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
+{
+ // judge cell border type
+ LwpCellBorderType eType = GetCellBorderType(nRow, nCol, pTableLayout);
+ return m_CellStyleNames[eType];
+}
+/**
+* Make the XFCell
+* @param aTableID - ID of the table which this cell belongs to
+* @param bIsTopRow - whether current cell is top row
+* @param bIsRightCol - whether current cell is the rightest column
+* @return XFCell*
+*/
+rtl::Reference<XFCell> LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+{
+ // if cell layout is aTableID's default cell layout
+ // it can't have any content, bypass these code
+ LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
+ if (!pTable)
+ {
+ assert(false);
+ return nullptr;
+ }
+ rtl::Reference<XFCell> xXFCell(new XFCell);
+ OUString aStyleName = m_StyleName;
+
+ // if cell layout is aTableID's default cell layout
+ // we should adjust its style by current position
+ if (pTable->GetDefaultCellStyle() == GetObjectID())
+ {
+ aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout().get());
+ }
+
+ // content of cell
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj().get());
+ if (pStory)
+ {
+ pStory->XFConvert(xXFCell.get());
+ }
+
+ ApplyProtect(xXFCell.get(), aTableID);
+ xXFCell->SetStyleName(aStyleName);
+ return xXFCell;
+}
+
+LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
+{
+ LwpObjectID* pPreStoryID = GetPreviousCellStory();
+ if (pPreStoryID && !(pPreStoryID->IsNull()))
+ {
+ LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY).get());
+ if (!pPreStory)
+ {
+ SAL_WARN("lwp", "unexpected null VO_STORY");
+ return nullptr;
+ }
+ return dynamic_cast<LwpPara*>(pPreStory->GetLastPara().obj(VO_PARA).get());
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+
+/**
+ * @short Get previous cell which used for bullet inside cell
+ * @param
+ * @return LwpObjectID * - object ID of cell content story
+ */
+LwpObjectID * LwpCellLayout::GetPreviousCellStory()
+{
+ LwpTable *pTable = GetTable();
+ if (!pTable)
+ {
+ assert(false);
+ return nullptr;
+ }
+ sal_uInt16 nRow = crowid;
+ sal_uInt16 nCol = ccolid;
+
+ // if table is reset paragraph in columns, get cell on the top side of current cell
+ if (pTable->IsNumberDown())
+ {
+ if (nRow == 0)
+ {
+ return nullptr;
+ }
+ nRow -=1;
+ }
+ else
+ {
+ // if not, get cell on the left side of current cell
+ if (nCol == 0)
+ {
+ if (nRow == 0)
+ {
+ return nullptr;
+ }
+ else
+ {
+ nRow--;
+ nCol = pTable->GetColumn() - 1;
+ }
+ }
+ else
+ {
+ nCol -=1;
+ }
+ }
+
+ // get the object id pointer of previous cell story
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (!pTableLayout)
+ {
+ assert(false);
+ return nullptr;
+ }
+ return pTableLayout->SearchCellStoryMap(nRow, nCol);
+}
+
+/**
+ * @short judge border type by cell neighbour
+ * @param nRow
+ * @param nCol
+ * @param pTableLayout
+ * @return LwpCellBorderType
+ */
+LwpCellBorderType LwpCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
+{
+ if (!pTableLayout)
+ return enumWholeBorder;
+
+ // get left cell and judge if neighbour border is different
+ std::unique_ptr<XFBorders> xBorders(GetXFBorders());
+ if (!xBorders)
+ {
+ return enumWholeBorder;
+ }
+ XFBorder& rLeftBorder = xBorders->GetLeft();
+ XFBorder& rBottomBorder = xBorders->GetBottom();
+ bool bNoLeftBorder = false;
+ bool bNoBottomBorder = false;
+
+ LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow, GetLeftColID(nCol), pTableLayout);
+ if (pLeftNeighbour)
+ {
+ std::unique_ptr<XFBorders> pNeighbourBorders = pLeftNeighbour->GetXFBorders();
+ if (pNeighbourBorders)
+ {
+ XFBorder& rRightBorder = pNeighbourBorders->GetRight();
+ if (rLeftBorder == rRightBorder)
+ {
+ // for these 2 types cell, left border should be ignored for sake of avoiding duplication border
+ // but if left border is different with right border of left cell
+ // we should not ignored it
+ bNoLeftBorder = true;
+ }
+ }
+
+ }
+
+ LwpCellLayout * pBelowNeighbour = GetCellByRowCol(GetBelowRowID(nRow), nCol, pTableLayout);
+ if (pBelowNeighbour) //&& (eType == enumRightNotLastCellBorder || eType == enumLeftNotLastCellBorder) )
+ {
+ std::unique_ptr<XFBorders> pBelowBorders = pBelowNeighbour->GetXFBorders();
+ if (pBelowBorders)
+ {
+ XFBorder& rTopBorder = pBelowBorders->GetTop();
+ if (rTopBorder == rBottomBorder)
+ {
+ // for these 2 types cell, bottom border should be ignored for sake of avoiding duplication border
+ // but if bottom border is different with right border of left cell
+ // we should not ignored it
+ bNoBottomBorder = true;
+ }
+ }
+ }
+
+ xBorders.reset();
+
+ if (bNoBottomBorder)
+ {
+ if (bNoLeftBorder)
+ {
+ return enumNoLeftNoBottomBorder;
+ }
+ return enumNoBottomBorder;
+ }
+ if (bNoLeftBorder)
+ {
+ return enumNoLeftBorder;
+ }
+ return enumWholeBorder;
+}
+
+/**
+ * @short Get neighbour cell by specifying ROW+COL
+ * @param nRow
+ * @param nCol
+ * @return LwpCellLayout *
+ */
+LwpCellLayout * LwpCellLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
+{
+ return pTableLayout->GetCellByRowCol(nRow, nCol);
+}
+/**
+ * @short Register table's default cell layout
+ * @param
+ * @return
+ */
+void LwpCellLayout::RegisterDefaultCell()
+{
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ for (sal_uInt16 eLoop = enumWholeBorder; eLoop < enumCellBorderTopLimit; eLoop++)
+ {
+ // register cell style
+ std::unique_ptr<XFCellStyle> xCellStyle(new XFCellStyle());
+
+ ApplyPadding(xCellStyle.get());
+ ApplyBackColor(xCellStyle.get());
+ ApplyWatermark(xCellStyle.get());
+ ApplyFmtStyle(xCellStyle.get());
+ xCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
+
+ std::unique_ptr<XFBorders> xBorders(GetXFBorders());
+ if (xBorders)
+ {
+ switch(eLoop)
+ {
+ case enumNoBottomBorder:
+
+ //| |
+
+ // remove bottom line
+ xBorders->SetWidth(enumXFBorderBottom, 0);
+ break;
+ case enumNoLeftNoBottomBorder:
+
+ // |
+
+ // remove left and bottom
+ xBorders->SetWidth(enumXFBorderLeft, 0);
+ xBorders->SetWidth(enumXFBorderBottom, 0);
+ break;
+ case enumWholeBorder:
+
+ //||
+
+ // nothing to remove
+ break;
+ case enumNoLeftBorder:
+
+ //| |
+
+ // remove left line
+ xBorders->SetWidth(enumXFBorderLeft, 0);
+ break;
+ default:
+ assert(false);
+ }
+ xCellStyle->SetBorders(xBorders.release());
+ }
+ m_CellStyleNames[eLoop] = pXFStyleManager->AddStyle(std::move(xCellStyle)).m_pStyle->GetStyleName();
+ }
+}
+/**
+ * @short Register 4 types of cell style and register content styles
+ * @param
+ * @param
+ * @param
+ * @return
+ */
+void LwpCellLayout::RegisterStyle()
+{
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout *>(GetParent().obj().get()));
+ if (!xParent.is() || xParent->GetLayoutType() != LWP_ROW_LAYOUT)
+ {
+ // default cell layout, we must register 4 styles for it
+ RegisterDefaultCell();
+ return;
+ }
+
+ // register cell style
+ std::unique_ptr<XFCellStyle> xCellStyle(new XFCellStyle);
+
+ ApplyPadding(xCellStyle.get());
+ ApplyBackGround(xCellStyle.get());
+ ApplyWatermark(xCellStyle.get());
+ ApplyFmtStyle(xCellStyle.get());
+ ApplyBorders(xCellStyle.get());
+
+ xCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xCellStyle)).m_pStyle->GetStyleName();
+
+ // content object register styles
+ rtl::Reference<LwpObject> pObj = m_Content.obj();
+ if (pObj.is())
+ {
+ pObj->SetFoundry(m_pFoundry);
+ pObj->DoRegisterStyle();
+ }
+
+ //register child layout style
+ RegisterChildStyle();
+}
+/**
+ * @short Read cell layout
+ * @param
+ * @return
+ */
+void LwpCellLayout::Read()
+{
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+
+ LwpMiddleLayout::Read();
+
+ // before the layout hierarchy rework
+ if (LwpFileHeader::m_nFileRevision < 0x000b)
+ {
+ assert(false);
+ }
+ else
+ {
+ crowid = pStrm->QuickReaduInt16();
+ ccolid = static_cast<sal_uInt8>(pStrm->QuickReaduInt16()); // written as a lushort
+
+ sal_uInt16 type;
+
+ type = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+ cType = static_cast<LeaderDotType>(type);
+
+ cLayNumerics.ReadIndexed(pStrm);
+ cLayDiagonalLine.ReadIndexed(pStrm);
+
+ pStrm->SkipExtra();
+ }
+}
+
+/**
+* Apply protect attribute to cell of table
+* @param aTableID - ID of the table which the cell belongs to
+* @param
+* @return XFCell*
+*/
+void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
+{
+ bool bProtected = false;
+ // judge current cell
+ if (GetIsProtected())
+ {
+ bProtected = true;
+ }
+ else
+ {
+ // judge base on
+ LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
+ if (pBase && pBase->GetIsProtected())
+ {
+ bProtected = true;
+ }
+ else
+ {
+ // judge whole table
+ LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
+ rtl::Reference<LwpTableLayout> xTableLayout(pTable ? pTable->GetTableLayout() : nullptr);
+ LwpSuperTableLayout * pSuper = xTableLayout.is() ? xTableLayout->GetSuperTableLayout() : nullptr;
+ if (pSuper && pSuper->GetIsProtected())
+ {
+ bProtected = true;
+ }
+ }
+ }
+
+ pCell->SetProtect(bProtected);
+}
+
+LwpConnectedCellLayout::LwpConnectedCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpCellLayout(objHdr, pStrm)
+ , cnumrows(0)
+ , cnumcols(0)
+ , m_nRealrowspan(0)
+ , m_nRealcolspan(0)
+{
+}
+
+LwpConnectedCellLayout::~LwpConnectedCellLayout()
+{}
+/**
+ * @short Set current connected cell layout to cell layout map
+ * @param pCellLayoutMap - cell layout map reference
+ * @return
+ */
+void LwpConnectedCellLayout::SetCellMap()
+{
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (!pTableLayout)
+ return;
+
+ sal_uInt16 nRowSpan = m_nRealrowspan;
+
+ for (sal_uInt16 iLoop = 0; iLoop < nRowSpan; iLoop ++)
+ {
+ for (sal_uInt16 jLoop = 0; jLoop < cnumcols; jLoop ++)
+ pTableLayout->SetWordProCellMap(iLoop + crowid, jLoop + ccolid, this);
+ }
+}
+
+/**
+ * @short judge border type by cell neighbour
+ * @param nRow
+ * @param nCol
+ * @param pTableLayout
+ * @return LwpCellBorderType
+ */
+LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
+{
+ if (!pTableLayout)
+ throw std::runtime_error("missing table layout");
+
+ sal_uInt16 nRowSpan = m_nRealrowspan;
+
+ // get left cell and judge if neighbour border is different
+ std::unique_ptr<XFBorders> xBorders(GetXFBorders());
+ if( !xBorders)
+ {
+ return enumWholeBorder;
+ }
+ XFBorder& rLeftBorder = xBorders->GetLeft();
+ XFBorder& rBottomBorder = xBorders->GetBottom();
+ bool bNoLeftBorder = true;
+ bool bNoBottomBorder = true;
+
+ if (nCol == 0)
+ {
+ bNoLeftBorder = false;
+ }
+ else
+ {
+ for (sal_uInt16 iLoop=0; iLoop < nRowSpan; iLoop++)
+ {
+ LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow+iLoop, GetLeftColID(nCol), pTableLayout);
+ if (pLeftNeighbour)
+ {
+ std::unique_ptr<XFBorders> pNeighbourBorders(pLeftNeighbour->GetXFBorders());
+ if (pNeighbourBorders)
+ {
+ XFBorder& rRightBorder = pNeighbourBorders->GetRight();
+ if (rLeftBorder != rRightBorder)
+ {
+ // if left border is different with right border of left cell
+ // we should not ignored it
+ bNoLeftBorder = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ LwpTable* pTable = pTableLayout->GetTable();
+ if (!pTable)
+ throw std::runtime_error("missing table");
+
+ if ( (nRow + nRowSpan) == pTable->GetRow())
+ {
+ bNoBottomBorder = false;
+ }
+ else
+ {
+ for (sal_uInt16 iLoop = 0; iLoop < cnumcols; iLoop ++)
+ {
+ LwpCellLayout * pBelowNeighbour = GetCellByRowCol(nRow + nRowSpan, nCol+iLoop, pTableLayout);
+ if (pBelowNeighbour)
+ {
+ std::unique_ptr<XFBorders> pBelowBorders(pBelowNeighbour->GetXFBorders());
+ if (pBelowBorders)
+ {
+ XFBorder& rTopBorder = pBelowBorders->GetTop();
+ if (rTopBorder != rBottomBorder)
+ {
+ // if bottom border is different with right border of left cell
+ // we should not ignored it
+ bNoBottomBorder = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ xBorders.reset();
+
+ if (bNoBottomBorder)
+ {
+ if (bNoLeftBorder)
+ {
+ return enumNoLeftNoBottomBorder;
+ }
+ return enumNoBottomBorder;
+ }
+ if (bNoLeftBorder)
+ {
+ return enumNoLeftBorder;
+ }
+ return enumWholeBorder;
+}
+/**
+ * @short Read connected cell layout
+ * @param
+ * @return
+ */
+void LwpConnectedCellLayout::Read()
+{
+ LwpCellLayout::Read();
+ sal_uInt16 numcols;
+
+ cnumrows = m_pObjStrm->QuickReaduInt16();
+ numcols = m_pObjStrm->QuickReaduInt16(); // written as a lushort
+ cnumcols = static_cast<sal_uInt8>(numcols);
+
+ m_nRealrowspan = cnumrows;
+ m_nRealcolspan = cnumcols;
+
+ m_pObjStrm->SkipExtra();
+}
+
+rtl::Reference<XFCell> LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+{
+ rtl::Reference<XFCell> xXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
+ xXFCell->SetColumnSpaned(cnumcols);
+ return xXFCell;
+}
+
+/**
+ * @short parse connected cell layout
+ * @param pOutputStream - output stream
+ * @return
+ */
+void LwpConnectedCellLayout::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+LwpHiddenCellLayout::LwpHiddenCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpCellLayout(objHdr, pStrm)
+{}
+
+LwpHiddenCellLayout::~LwpHiddenCellLayout()
+{}
+/**
+ * @short Set current hidden cell layout to cell layout map
+ * @param
+ * @return
+ */
+void LwpHiddenCellLayout::SetCellMap()
+{
+}
+/**
+ * @short Read hidden cell layout
+ * @param
+ * @return
+ */
+void LwpHiddenCellLayout::Read()
+{
+ LwpCellLayout::Read();
+
+ cconnectedlayout.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+
+}
+/**
+ * @short Convert hidden cell layout
+ * @param aTableID - Object ID of table
+ * @return XFCell * - pointer to converted cell
+ */
+
+rtl::Reference<XFCell> LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+{
+ if (!cconnectedlayout.obj().is())
+ return nullptr;
+ LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj().get());
+
+ if (!pConnCell || nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
+ return nullptr;
+ // if the hidden cell should be displayed for limit of SODC
+ // use the default cell layout
+ rtl::Reference<XFCell> xXFCell;
+ LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
+ if (pTable)
+ {
+ LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get());
+ if (pDefault)
+ {
+ xXFCell = pDefault->DoConvertCell(aTableID, nRow, nCol);
+ }
+ else
+ {
+ xXFCell = pConnCell->DoConvertCell(aTableID, nRow, nCol);
+ }
+ xXFCell->SetColumnSpaned(pConnCell->GetNumcols());
+ }
+ else
+ {
+ assert(false);
+ }
+ return xXFCell;
+}
+/**
+ * @short parse hidden cell layout
+ * @param pOutputStream - output stream
+ * @return
+ */
+ void LwpHiddenCellLayout::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+LwpParallelColumnsBlock::LwpParallelColumnsBlock(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpCellLayout(objHdr, pStrm)
+{}
+
+LwpParallelColumnsBlock::~LwpParallelColumnsBlock()
+{}
+
+void LwpParallelColumnsBlock::Read()
+{
+ LwpCellLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcelllayout.hxx b/lotuswordpro/source/filter/lwpcelllayout.hxx
new file mode 100644
index 000000000..e6a313070
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcelllayout.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - cell layouts
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCELLLAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCELLLAYOUT_HXX
+
+#include "lwplayout.hxx"
+#include <xfilter/xfcell.hxx>
+
+typedef enum
+{
+ enumWholeBorder = 0,
+ enumNoLeftBorder,
+ enumNoBottomBorder,
+ enumNoLeftNoBottomBorder,
+ enumCellBorderTopLimit = 4,
+} LwpCellBorderType;
+
+class XFCell;
+class XFCellStyle;
+class LwpCellList;
+class LwpTable;
+class LwpTableLayout;
+/**
+ * @brief
+ * VO_CELLLAYOUT object
+ */
+class LwpCellLayout : public LwpMiddleLayout
+{
+public:
+ LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpCellLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CELL_LAYOUT;}
+ rtl::Reference<XFCell> DoConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+ {
+ if (m_bConvertCell)
+ throw std::runtime_error("recursion in page divisions");
+ m_bConvertCell = true;
+ rtl::Reference<XFCell> aRet = ConvertCell(aTableID, nRow, nCol);
+ m_bConvertCell = false;
+ return aRet;
+ }
+ sal_uInt16 GetRowID() const {return crowid;}
+ sal_uInt8 GetColID() const {return ccolid;}
+ void RegisterStyle() override;
+ LwpObjectID& GetNumericsObject() {return cLayNumerics;}
+ LwpObjectID * GetPreviousCellStory();
+ virtual LwpPara* GetLastParaOfPreviousStory() override;
+ LwpTableLayout * GetTableLayout();
+ virtual void SetCellMap();
+ double GetActualWidth();
+ const OUString& GetNumfmtName() const {return m_NumfmtName;}
+protected:
+ void Read() override;
+ LwpTable * GetTable();
+ void ApplyPadding(XFCellStyle* pCellStyle);
+ void ApplyBorders(XFCellStyle* pCellStyle);
+ void ApplyPatternFill(XFCellStyle* pCellStyle);
+ void ApplyBackGround(XFCellStyle* pCellStyle);
+ void ApplyBackColor(XFCellStyle* pCellStyle);
+ void ApplyWatermark(XFCellStyle* pCellStyle);
+ void ApplyProtect(XFCell * pCell, LwpObjectID aTableID);
+ void ApplyFmtStyle(XFCellStyle *pCellStyle);
+ OUString const & GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
+ void RegisterDefaultCell();
+ virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
+ virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol);
+ static LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
+ static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; };
+ virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; };
+
+ bool m_bConvertCell;
+ sal_uInt16 crowid;
+ sal_uInt8 ccolid;
+ LwpObjectID cLayNumerics;
+ LwpObjectID cLayDiagonalLine;
+
+ enum LeaderDotType
+ {
+ LDT_NONE = 0,
+ LDT_DOTS = 1,
+ LDT_DASHES = 2,
+ LDT_UNDERSCORES = 3
+ };
+ LeaderDotType cType;
+ OUString m_CellStyleNames[enumCellBorderTopLimit];
+
+ OUString m_NumfmtName;//Add to support number color
+};
+
+/**
+ * @brief
+ * VO_HIDDENCELLLAYOUT object
+ */
+class LwpHiddenCellLayout final : public LwpCellLayout
+{
+public:
+ LwpHiddenCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpHiddenCellLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;}
+ virtual void Parse(IXFStream* pOutputStream) override;
+ void RegisterStyle() override {}
+ virtual void SetCellMap() override;
+private:
+ void Read() override;
+ virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
+ LwpObjectID cconnectedlayout;
+};
+
+/**
+ * @brief
+ * VO_CONNECTEDCELLLAYOUT object
+ */
+class LwpConnectedCellLayout : public LwpCellLayout
+{
+public:
+ LwpConnectedCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpConnectedCellLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;}
+ virtual void Parse(IXFStream* pOutputStream) override;
+ sal_uInt16 GetNumrows() const {return m_nRealrowspan;}
+ sal_uInt8 GetNumcols() const {return m_nRealcolspan;}
+ virtual void SetCellMap() override;
+ void SetNumrows(sal_uInt16 nVal){m_nRealrowspan = nVal;}
+protected:
+ void Read() override;
+ virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow) override {return nRow + m_nRealrowspan; };
+ virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout) override;
+ virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
+ sal_uInt16 cnumrows;
+ sal_uInt8 cnumcols;
+ sal_uInt16 m_nRealrowspan;
+ sal_uInt8 m_nRealcolspan;
+};
+/**
+ * @brief
+ * VO_PCOLBLOCK object
+ */
+
+class LwpParallelColumnsBlock : public LwpCellLayout
+{
+public:
+ LwpParallelColumnsBlock(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpParallelColumnsBlock() override;
+protected:
+ void Read() override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpchangemgr.cxx b/lotuswordpro/source/filter/lwpchangemgr.cxx
new file mode 100644
index 000000000..f24c1ddf7
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpchangemgr.cxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpchangemgr.hxx>
+#include <rtl/ustring.hxx>
+#include "lwppara.hxx"
+#include "lwpfribheader.hxx"
+#include "lwpfribptr.hxx"
+#include <lwpfrib.hxx>
+#include "lwpstory.hxx"
+#include "lwpfribsection.hxx"
+#include "lwpsection.hxx"
+#include "lwpfribbreaks.hxx"
+#include "lwpfribframe.hxx"
+#include "lwpfribtable.hxx"
+#include "lwphyperlinkmgr.hxx"
+#include "lwpfootnote.hxx"
+#include "lwpnotes.hxx"
+#include "lwpfribmark.hxx"
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/xftabstop.hxx>
+#include <xfilter/xflinebreak.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfhyperlink.hxx>
+
+LwpChangeMgr::LwpChangeMgr()
+{
+ m_nCounter = 0;
+ m_DocFribMap.clear();
+ m_HeadFootFribMap.clear();
+ m_pFribMap = &m_DocFribMap;
+ m_ChangeList.clear();
+}
+
+LwpChangeMgr::~LwpChangeMgr()
+{
+ m_pFribMap = nullptr;
+ m_DocFribMap.clear();
+ m_HeadFootFribMap.clear();
+ m_ChangeList.clear();
+}
+
+void LwpChangeMgr::AddChangeFrib(LwpFrib* pFrib)
+{
+ m_nCounter++;
+ OUString sID = "ct" + OUString::number(m_nCounter);
+ m_pFribMap->insert(std::pair<LwpFrib*, OUString>(pFrib, sID));
+ pFrib->Register(m_pFribMap);
+}
+
+OUString LwpChangeMgr::GetChangeID(LwpFrib* pFrib)
+{
+ auto iter = m_pFribMap->find(pFrib);
+ if (iter == m_pFribMap->end())
+ return OUString();
+ else
+ return iter->second;
+}
+
+void LwpChangeMgr::ConvertAllChange(IXFStream* pStream)
+{
+ for (auto const& docFrib : m_DocFribMap)
+ {
+ if (docFrib.first->GetRevisionType() == LwpFrib::REV_INSERT)
+ {
+ XFChangeInsert* pInsert = new XFChangeInsert;
+ pInsert->SetChangeID(docFrib.second);
+ pInsert->SetEditor(docFrib.first->GetEditor());
+ m_ChangeList.push_back(pInsert);
+ }
+ else if (docFrib.first->GetRevisionType() == LwpFrib::REV_DELETE)
+ {
+ XFChangeDelete* pDelete = new XFChangeDelete;
+ pDelete->SetChangeID(docFrib.second);
+ pDelete->SetEditor(docFrib.first->GetEditor());
+ m_ChangeList.push_back(pDelete);
+ }
+ }
+
+ pStream->GetAttrList()->Clear();
+ if (m_ChangeList.empty())
+ return;
+ // Add for disable change tracking
+ pStream->GetAttrList()->AddAttribute("text:track-changes", "false");
+ pStream->StartElement("text:tracked-changes");
+ for (auto const& elem : m_ChangeList)
+ elem->ToXml(pStream);
+
+ pStream->EndElement("text:tracked-changes");
+
+ m_ChangeList.clear();
+}
+void LwpChangeMgr::SetHeadFootFribMap(bool bFlag)
+{
+ if (bFlag)
+ m_pFribMap = &m_HeadFootFribMap;
+ else
+ {
+ m_HeadFootFribMap.clear();
+ m_pFribMap = &m_DocFribMap;
+ }
+}
+
+void LwpChangeMgr::SetHeadFootChange(XFContentContainer* pCont)
+{
+ XFChangeList* pChangeList = new XFChangeList;
+
+ for (auto const& headFootFrib : m_HeadFootFribMap)
+ {
+ if (headFootFrib.first->GetRevisionType() == LwpFrib::REV_INSERT)
+ {
+ XFChangeInsert* pInsert = new XFChangeInsert;
+ pInsert->SetChangeID(headFootFrib.second);
+ pInsert->SetEditor(headFootFrib.first->GetEditor());
+ pChangeList->Add(pInsert);
+ }
+ else if (headFootFrib.first->GetRevisionType() == LwpFrib::REV_DELETE)
+ {
+ XFChangeDelete* pDelete = new XFChangeDelete;
+ pDelete->SetChangeID(headFootFrib.second);
+ pDelete->SetEditor(headFootFrib.first->GetEditor());
+ pChangeList->Add(pDelete);
+ }
+ }
+
+ pCont->Add(pChangeList);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharacterstyle.cxx b/lotuswordpro/source/filter/lwpcharacterstyle.cxx
new file mode 100644
index 000000000..da393770d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcharacterstyle.cxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpcharacterstyle.hxx"
+#include <lwpfilehdr.hxx>
+#include <lwptools.hxx>
+#include <lwpoverride.hxx>
+#include <lwpatomholder.hxx>
+#include <lwpfont.hxx>
+#include <lwpfoundry.hxx>
+#include "lwpcharborderoverride.hxx"
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xftextstyle.hxx>
+
+
+/*class LwpTextStyle*/
+LwpTextStyle::LwpTextStyle(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpDLNFPVList(objHdr, pStrm),
+ m_nFontID(0), m_nFinalFontID(0), m_nCSFlags(0), m_nUseCount(0),
+ m_nStyleDefinition(0), m_nKey(0)
+{
+}
+
+void LwpTextStyle::Read()
+{
+ LwpDLNFPVList::Read();
+ ReadCommon();
+}
+
+LwpTextStyle::~LwpTextStyle()
+{
+}
+
+void LwpTextStyle::ReadCommon()
+{
+ m_nFontID = m_pObjStrm->QuickReaduInt32();
+ m_nFinalFontID = m_pObjStrm->QuickReaduInt32();
+ m_nCSFlags = m_pObjStrm->QuickReaduInt16();
+ m_nUseCount = m_pObjStrm->QuickReaduInt32();
+
+ m_aDescription.Read(m_pObjStrm.get());
+
+ m_aLangOverride.Read(m_pObjStrm.get());
+ m_aTxtAttrOverride.Read(m_pObjStrm.get());
+ if (LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ m_aCharacterBorderOverride.Read(m_pObjStrm.get());
+ m_aAmikakeOverride.Read(m_pObjStrm.get());
+ }
+ else
+ {
+ m_CharacterBorder.ReadIndexed(m_pObjStrm.get());
+ m_Amikake.ReadIndexed(m_pObjStrm.get());
+ }
+ sal_uInt16 nCount = 6;
+ if (LwpFileHeader::m_nFileRevision > 0x0005)
+ nCount = m_pObjStrm->QuickReaduInt16();
+
+ m_FaceStyle.ReadIndexed(m_pObjStrm.get());
+
+ if (nCount > 1)
+ {
+ m_SizeStyle.ReadIndexed(m_pObjStrm.get());
+ m_AttributeStyle.ReadIndexed(m_pObjStrm.get());
+ m_FontStyle.ReadIndexed(m_pObjStrm.get());
+ m_CharacterBorderStyle.ReadIndexed(m_pObjStrm.get());
+ m_AmikakeStyle.ReadIndexed(m_pObjStrm.get());
+ }
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ m_nStyleDefinition = m_pObjStrm->QuickReaduInt32();
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ m_nKey = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+ }
+ }
+
+}
+
+void LwpTextStyle::RegisterStyle()
+{
+ if (!m_pFoundry)
+ {
+ assert(false);
+ return;
+ }
+
+ std::unique_ptr<XFTextStyle> pStyle(new XFTextStyle());
+
+ //Set name
+ OUString styleName = GetName().str();
+ pStyle->SetStyleName(styleName);
+
+ //Create font
+ LwpFontManager& rFontMgr = m_pFoundry->GetFontManger();
+ rtl::Reference<XFFont> pFont = rFontMgr.CreateFont(m_nFinalFontID);
+ pStyle->SetFont(pFont);
+
+ //Set other properties if needed
+
+ //Add style
+ LwpStyleManager* pStyleMgr = m_pFoundry->GetStyleManager();
+ pStyleMgr->AddStyle(GetObjectID(), std::move(pStyle));
+
+}
+
+/*class LwpCharacterStyle*/
+LwpCharacterStyle::LwpCharacterStyle(LwpObjectHeader const & objHdr, LwpSvStream* pStrm) :
+LwpTextStyle(objHdr, pStrm)
+{
+}
+
+void LwpCharacterStyle::Read()
+{
+ LwpTextStyle::Read();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharacterstyle.hxx b/lotuswordpro/source/filter/lwpcharacterstyle.hxx
new file mode 100644
index 000000000..53cb0ae20
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcharacterstyle.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCHARACTERSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCHARACTERSTYLE_HXX
+
+#include "lwpdlvlist.hxx"
+#include <lwpoverride.hxx>
+#include "lwpcharborderoverride.hxx"
+
+class LwpAtomHolder;
+class LwpTextLanguageOverride;
+class LwpTextAttributeOverride;
+class LwpCharacterBorderOverride;
+class LwpAmikakeOverride;
+
+class LwpTextStyle : public LwpDLNFPVList
+{
+public:
+ LwpTextStyle(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+
+ virtual ~LwpTextStyle() override;
+
+ inline sal_uInt32 GetFinalFontID() const;
+
+ virtual void RegisterStyle() override;
+
+protected:
+ void ReadCommon();
+ void Read() override;
+
+protected:
+
+ sal_uInt32 m_nFontID;
+ sal_uInt32 m_nFinalFontID;
+ sal_uInt16 m_nCSFlags;
+ sal_uInt32 m_nUseCount;
+
+ LwpAtomHolder m_aDescription;
+ LwpTextLanguageOverride m_aLangOverride;
+ LwpTextAttributeOverride m_aTxtAttrOverride;
+
+ LwpCharacterBorderOverride m_aCharacterBorderOverride;
+ LwpAmikakeOverride m_aAmikakeOverride;
+
+ LwpObjectID m_CharacterBorder;
+ LwpObjectID m_Amikake;
+ LwpObjectID m_FaceStyle;
+
+ LwpObjectID m_SizeStyle;
+ LwpObjectID m_AttributeStyle;
+ LwpObjectID m_FontStyle;
+ LwpObjectID m_CharacterBorderStyle;
+ LwpObjectID m_AmikakeStyle;
+
+ sal_uInt32 m_nStyleDefinition;
+// sal_uInt16 m_nBasedOnCount;
+ sal_uInt16 m_nKey;
+
+};
+
+inline sal_uInt32 LwpTextStyle::GetFinalFontID() const
+{
+ return m_nFinalFontID;
+}
+
+class LwpCharacterStyle : public LwpTextStyle
+{
+public:
+ LwpCharacterStyle(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+
+ void Read() override;
+
+private:
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharborderoverride.cxx b/lotuswordpro/source/filter/lwpcharborderoverride.cxx
new file mode 100644
index 000000000..acca8e238
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcharborderoverride.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+
+#include "clone.hxx"
+#include "lwpcharborderoverride.hxx"
+#include "lwpborderstuff.hxx"
+#include "lwpmargins.hxx"
+
+LwpCharacterBorderOverride::LwpCharacterBorderOverride()
+ : m_pBorderStuff(new LwpBorderStuff)
+ , m_pMargins(new LwpMargins)
+ , m_nAboveWidth(0)
+ , m_nBelowWidth(0)
+{
+}
+
+LwpCharacterBorderOverride::LwpCharacterBorderOverride(LwpCharacterBorderOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nAboveWidth(rOther.m_nAboveWidth)
+ , m_nBelowWidth(rOther.m_nBelowWidth)
+{
+ std::unique_ptr<LwpBorderStuff> pBorderStuff(::clone(rOther.m_pBorderStuff.get()));
+ std::unique_ptr<LwpMargins> pMargins(::clone(rOther.m_pMargins.get()));
+ m_pBorderStuff = std::move(pBorderStuff);
+ m_pMargins = std::move(pMargins);
+}
+
+LwpCharacterBorderOverride::~LwpCharacterBorderOverride() {}
+
+LwpCharacterBorderOverride* LwpCharacterBorderOverride::clone() const
+{
+ return new LwpCharacterBorderOverride(*this);
+}
+
+void LwpCharacterBorderOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_pBorderStuff->Read(pStrm);
+ m_pMargins->Read(pStrm);
+ m_nAboveWidth = pStrm->QuickReaduInt32();
+ m_nBelowWidth = pStrm->QuickReaduInt32();
+ }
+
+ pStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharborderoverride.hxx b/lotuswordpro/source/filter/lwpcharborderoverride.hxx
new file mode 100644
index 000000000..478ceed45
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcharborderoverride.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCHARBORDEROVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCHARBORDEROVERRIDE_HXX
+
+#include <lwpoverride.hxx>
+
+class LwpBorderStuff;
+class LwpMargins;
+class LwpCharacterBorderOverride final : public LwpOverride
+{
+public:
+ LwpCharacterBorderOverride();
+
+ virtual ~LwpCharacterBorderOverride() override;
+
+ virtual LwpCharacterBorderOverride* clone() const override;
+
+ void Read(LwpObjectStream* pStrm) override;
+
+private:
+ LwpCharacterBorderOverride(LwpCharacterBorderOverride const& rOther);
+ LwpCharacterBorderOverride& operator=(LwpCharacterBorderOverride const& rOther) = delete;
+
+ std::unique_ptr<LwpBorderStuff> m_pBorderStuff;
+ std::unique_ptr<LwpMargins> m_pMargins;
+ sal_Int32 m_nAboveWidth;
+ sal_Int32 m_nBelowWidth;
+
+ enum
+ {
+ PBO_STUFF = 0x01,
+ PBO_MARGINS = 0x04,
+ PBO_ABOVE = 0x40,
+ PBO_BELOW = 0x80
+ };
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharsetmgr.cxx b/lotuswordpro/source/filter/lwpcharsetmgr.cxx
new file mode 100644
index 000000000..46abee27d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcharsetmgr.cxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+#include "lwpcharsetmgr.hxx"
+//Added for SS migration
+#include <rtl/textenc.h>
+
+LwpCharSetMgr* LwpCharSetMgr::Instance = nullptr;
+
+LwpCharSetMgr* LwpCharSetMgr::GetInstance()
+{
+ if (Instance == nullptr)
+ Instance = new LwpCharSetMgr;
+ return Instance;
+}
+
+void LwpCharSetMgr::SetCodePageMap()
+{//sal_uInt16 wordproCode,rtl_TextEncoding encoding, tmp hardcoding, 1-18
+/* m_CodePageMap[256] =
+ m_CodePageMap[259] =
+ m_CodePageMap[819] =
+ m_CodePageMap[921] =*/
+ m_CodePageMap[437] = RTL_TEXTENCODING_ASCII_US;
+ m_CodePageMap[850] = RTL_TEXTENCODING_IBM_850;
+ //m_CodePageMap[851] = RTL_TEXTENCODING_IBM_851;
+ m_CodePageMap[852] = RTL_TEXTENCODING_IBM_852;
+ m_CodePageMap[857] = RTL_TEXTENCODING_IBM_857;
+ m_CodePageMap[860] = RTL_TEXTENCODING_IBM_860;
+ m_CodePageMap[863] = RTL_TEXTENCODING_IBM_863;
+ m_CodePageMap[865] = RTL_TEXTENCODING_IBM_865;
+ m_CodePageMap[866] = RTL_TEXTENCODING_IBM_866;
+ m_CodePageMap[869] = RTL_TEXTENCODING_IBM_869;
+ m_CodePageMap[874] = RTL_TEXTENCODING_MS_874;//thai
+ m_CodePageMap[932] = RTL_TEXTENCODING_MS_932; //japanese
+ m_CodePageMap[936] = RTL_TEXTENCODING_MS_936; //chinese simple
+ m_CodePageMap[949] = RTL_TEXTENCODING_MS_949;//korean
+ m_CodePageMap[950] = RTL_TEXTENCODING_BIG5;//chinese traditional
+ m_CodePageMap[1250] = RTL_TEXTENCODING_MS_1250;//Central European
+ m_CodePageMap[1252] = RTL_TEXTENCODING_MS_1252;
+ m_CodePageMap[1251] = RTL_TEXTENCODING_MS_1251; //ukrainian belarusian macedonian russian
+ m_CodePageMap[1253] = RTL_TEXTENCODING_MS_1253;//greek
+ m_CodePageMap[1254] = RTL_TEXTENCODING_MS_1254;//Turkish
+ m_CodePageMap[1255] = RTL_TEXTENCODING_MS_1255;//hebrew
+ m_CodePageMap[1256] = RTL_TEXTENCODING_MS_1256;//arabic
+ m_CodePageMap[1257] = RTL_TEXTENCODING_MS_1257;//estonian
+}
+
+rtl_TextEncoding LwpCharSetMgr::GetTextCharEncoding(sal_uInt16 wordproCode)
+{
+ std::map<sal_uInt16,rtl_TextEncoding>::iterator
+ pos = m_CodePageMap.find(wordproCode);
+ if (pos != m_CodePageMap.end())
+ return m_CodePageMap[wordproCode];
+ return GetTextCharEncoding();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharsetmgr.hxx b/lotuswordpro/source/filter/lwpcharsetmgr.hxx
new file mode 100644
index 000000000..c48e37c6a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcharsetmgr.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCHARSETMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCHARSETMGR_HXX
+
+#include <rtl/textenc.h>
+#include <map>
+
+class LwpCharSetMgr
+{
+public:
+ LwpCharSetMgr() { SetCodePageMap(); }
+ static LwpCharSetMgr* GetInstance();
+ void SetCodePageMap();
+ rtl_TextEncoding GetTextCharEncoding(sal_uInt16 wordproCode);
+ static rtl_TextEncoding GetTextCharEncoding()
+ {
+ return RTL_TEXTENCODING_MS_1252; //here should be a default value,1252 or get from platform, 1-18
+ }
+
+private:
+ std::map<sal_uInt16, rtl_TextEncoding> m_CodePageMap;
+ static LwpCharSetMgr* Instance;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcolor.cxx b/lotuswordpro/source/filter/lwpcolor.cxx
new file mode 100644
index 000000000..14f580368
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcolor.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpcolor.hxx>
+
+/**
+ * @descr return the BGR format
+*/
+sal_uInt32 LwpColor::To24Color()
+{
+ return ((m_nRed >> 8) | (m_nGreen & 0xFF00) | static_cast<sal_uInt32>((m_nBlue & 0xFF00) << 8));
+}
+
+/**
+ * @descr read color and then resolve the RGB values
+*/
+void LwpColor::Read(LwpObjectStream* pStrm)
+{
+ m_nRed = pStrm->QuickReaduInt16();
+ m_nGreen = pStrm->QuickReaduInt16();
+ m_nBlue = pStrm->QuickReaduInt16();
+ m_nExtra = pStrm->QuickReaduInt16();
+
+ // resolve RGB values per the extra bytes
+ switch (m_nExtra)
+ {
+ case AGLRGB_RGB:
+ break;
+ case AGLRGB_RED:
+ m_nRed = 0xFFFF;
+ m_nGreen = 0x0000;
+ m_nBlue = 0x0000;
+ break;
+ case AGLRGB_GREEN:
+ m_nRed = 0x0000;
+ m_nGreen = 0xFFFF;
+ m_nBlue = 0x0000;
+ break;
+ case AGLRGB_BLUE:
+ m_nRed = 0x0000;
+ m_nGreen = 0x0000;
+ m_nBlue = 0xFFFF;
+ break;
+ case AGLRGB_BLACK:
+ m_nRed = 0x0000;
+ m_nGreen = 0x0000;
+ m_nBlue = 0x0000;
+ break;
+ case AGLRGB_WHITE:
+ m_nRed = 0xFFFF;
+ m_nGreen = 0xFFFF;
+ m_nBlue = 0xFFFF;
+ break;
+ case AGLRGB_GRAY:
+ m_nRed = 0x8080;
+ m_nGreen = 0x8080;
+ m_nBlue = 0x8080;
+ break;
+ case AGLRGB_LTGRAY:
+ m_nRed = 0xC0C0;
+ m_nGreen = 0xC0C0;
+ m_nBlue = 0xC0C0;
+ break;
+ case AGLRGB_DKGRAY:
+ m_nRed = 0x4040;
+ m_nGreen = 0x4040;
+ m_nBlue = 0x4040;
+ break;
+ case AGLRGB_INVALID:
+ case AGLRGB_TRANSPARENT:
+ default:
+ m_nRed = 0;
+ m_nGreen = 0;
+ m_nBlue = 0;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcontent.cxx b/lotuswordpro/source/filter/lwpcontent.cxx
new file mode 100644
index 000000000..164038a1d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcontent.cxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpstory.hxx"
+#include <lwpfilehdr.hxx>
+#include "lwpholder.hxx"
+
+LwpHeadContent::LwpHeadContent(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpContent(objHdr, pStrm)
+{}
+
+void LwpHeadContent::Read()
+{
+ LwpContent::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+LwpContent::LwpContent(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLNFVList(objHdr, pStrm)
+ , m_nFlags(0)
+{
+}
+
+void LwpContent::Read()
+{
+ LwpDLNFVList::Read();
+
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+
+ m_LayoutsWithMe.Read(pStrm);
+ m_nFlags = pStrm->QuickReaduInt16();
+ m_nFlags &= ~(CF_CHANGED | CF_DISABLEVALUECHECKING);
+ //LwpAtomHolder ClassName;
+ //ClassName.Read(pStrm);
+ m_ClassName.Read(pStrm);
+
+ LwpObjectID SkipID;
+ if(LwpFileHeader::m_nFileRevision >= 0x0006)
+ {
+ //SkipID.ReadIndexed(pStrm);
+ //SkipID.ReadIndexed(pStrm);
+ m_NextEnumerated.ReadIndexed(pStrm);
+ m_PreviousEnumerated.ReadIndexed(pStrm);
+ }
+
+ if (LwpFileHeader::m_nFileRevision >= 0x0007)
+ {
+ if(LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ SkipID.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+ }
+ else
+ {
+ sal_uInt8 HasNotify = pStrm->QuickReaduInt8();
+ if(HasNotify)
+ {
+ SkipID.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+ }
+ }
+ }
+
+ pStrm->SkipExtra();
+}
+
+rtl::Reference<LwpVirtualLayout> LwpContent::GetLayout(LwpVirtualLayout const * pStartLayout)
+{
+ return m_LayoutsWithMe.GetLayout(pStartLayout);
+}
+
+bool LwpContent::HasNonEmbeddedLayouts()
+{
+ rtl::Reference<LwpVirtualLayout> xLayout;
+ while (true)
+ {
+ xLayout = GetLayout(xLayout.get());
+ if (!xLayout.is())
+ break;
+ if (!xLayout->NoContentReference())
+ return true;
+ }
+ return false;
+}
+
+bool LwpContent::IsStyleContent()
+{
+ rtl::Reference<LwpVirtualLayout> xLayout;
+ while (true)
+ {
+ xLayout = GetLayout(xLayout.get());
+ if (!xLayout.is())
+ break;
+ if (xLayout->IsStyleLayout())
+ return true;
+ }
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcontent.hxx b/lotuswordpro/source/filter/lwpcontent.hxx
new file mode 100644
index 000000000..7fc976d98
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpcontent.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * LwpContent, LwpHeadContent: base class for Word Pro content object
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCONTENT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCONTENT_HXX
+
+#include <config_lgpl.h>
+#include <lwpobj.hxx>
+#include <lwpatomholder.hxx>
+#include "lwplayout.hxx"
+
+/**
+ * @brief
+ * Base class of all Lwp content objects
+ */
+class LwpContent : public LwpDLNFVList
+{
+public:
+ LwpContent(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+private:
+ LwpAssociatedLayouts m_LayoutsWithMe;
+ sal_uInt16 m_nFlags;
+ LwpAtomHolder m_ClassName;
+ LwpObjectID m_NextEnumerated;
+ LwpObjectID m_PreviousEnumerated;
+ /* Flag bits */
+ enum
+ {
+ CF_CHANGED = 0x0001,
+ CF_MODIFIED = 0x0004,
+ CF_LOCAL = 0x0008,
+ CF_INFOOTNOTE = 0x0010,
+ CF_METACHANGED = 0x0020,
+ CF_PRIVATE = 0x0040,
+ CF_DEACTIVATED = 0x0080,
+ CF_VALUECHANGED = 0x0100,
+ CF_DISABLEVALUECHECKING = 0x0200,
+ CF_DONTNOTIFYDOCUMENT = 0x0400, // for numeric formatting
+ CF_ISOVERRIDE = 0x0800,
+ CF_ISBULLET = 0x1000,
+ CF_CONTINUEDON = 0x2000,
+ CF_CONTINUEDFROM = 0x4000,
+
+ // Bits that should be transferred when we duplicate a content
+ CF_COPYMASK = (CF_MODIFIED | CF_PRIVATE)
+ };
+protected:
+ void Read() override;
+public:
+ inline LwpAssociatedLayouts& GetLayoutsWithMe();
+ rtl::Reference<LwpVirtualLayout> GetLayout(LwpVirtualLayout const * pStartLayout);
+ inline bool IsActive() const;
+ virtual bool IsTable();
+ inline OUString const & GetClassName() const;
+ inline LwpContent* GetNextEnumerated();
+ bool HasNonEmbeddedLayouts();
+ bool IsStyleContent();
+};
+
+LwpAssociatedLayouts& LwpContent::GetLayoutsWithMe()
+{
+ return m_LayoutsWithMe;
+}
+
+inline bool LwpContent::IsActive() const
+{
+ return !(m_nFlags & CF_DEACTIVATED);
+}
+
+inline bool LwpContent::IsTable()
+{
+ return false;
+}
+
+inline OUString const & LwpContent::GetClassName() const
+{
+ return m_ClassName.str();
+}
+
+inline LwpContent* LwpContent::GetNextEnumerated()
+{
+ return dynamic_cast<LwpContent*>(m_NextEnumerated.obj().get());
+}
+/**
+ * @brief
+ * Head object of content list
+ */
+class LwpHeadContent : public LwpContent
+{
+public:
+ LwpHeadContent(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+protected:
+ void Read() override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdivinfo.cxx b/lotuswordpro/source/filter/lwpdivinfo.cxx
new file mode 100644
index 000000000..641869401
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdivinfo.cxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpdivinfo.hxx"
+#include "lwpdoc.hxx"
+#include <lwpobjstrm.hxx>
+#include <lwpfilehdr.hxx>
+#include "lwpholder.hxx"
+#include "lwppagehint.hxx"
+#include <sal/log.hxx>
+
+LwpDivInfo::LwpDivInfo(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+ , m_nFlags(0)
+ , m_nPageNoStyle(0)
+{
+}
+
+LwpDivInfo::~LwpDivInfo(){}
+
+void LwpDivInfo::Read()
+{
+
+ SkipFront();
+ m_ParentID.ReadIndexed(m_pObjStrm.get());
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ {
+ m_pObjStrm->SkipExtra();
+ }
+ m_Name.Read(m_pObjStrm.get());
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ {
+ m_pObjStrm->SkipExtra();
+ }
+
+ m_LayoutID.ReadIndexed(m_pObjStrm.get());
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ if (LwpFileHeader::m_nFileRevision < 0x0010) // In 98, graphic links count too
+ {
+ if ((m_nFlags & DI_ANYOLEDDELINKS) == 0)
+ m_nFlags &= ~DI_KNOWIFANYOLEDDELINKS;
+ }
+
+ m_ExternalName.Read(m_pObjStrm.get());
+ m_ExternalType.Read(m_pObjStrm.get());
+ m_ClassName.Read(m_pObjStrm.get());
+ m_InitialLayoutID.ReadIndexed(m_pObjStrm.get());
+
+ m_nPageNoStyle = m_pObjStrm->QuickReaduInt16();
+ m_TabColor.Read(m_pObjStrm.get());
+
+ // read filler page stuff
+ m_FillerPageTextID.ReadIndexed(m_pObjStrm.get());
+
+ // read external file object stuff
+ sal_uInt16 type = m_pObjStrm->QuickReaduInt16();
+ //cpExternalFile = LNULL;
+
+ SAL_WARN_IF(type != 0, "lwp", "should be 0");
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpDivInfo::SkipFront()
+{
+ LwpObjectID toSkip;
+
+ toSkip.ReadIndexed(m_pObjStrm.get()); // skip ListNext;
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ {
+ m_pObjStrm->SkipExtra();
+ }
+ toSkip.ReadIndexed(m_pObjStrm.get()); // skip ListPrevious;
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ {
+ m_pObjStrm->SkipExtra();
+ }
+ toSkip.ReadIndexed(m_pObjStrm.get()); // skip Head;
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ {
+ toSkip.ReadIndexed(m_pObjStrm.get()); //skip tail
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpDivInfo::GetNumberOfPages(sal_uInt16 & nPageno)
+{
+ if(IsGotoable())
+ {
+ if (IsOleDivision())
+ {
+ //not support now
+ return;
+ }
+ else
+ {
+ nPageno += GetMaxNumberOfPages();
+ }
+ }
+}
+
+sal_uInt16 LwpDivInfo::GetMaxNumberOfPages() const
+{
+ LwpDocument* pDiv = dynamic_cast<LwpDocument*>(m_ParentID.obj().get());
+ if(!pDiv)
+ return 0;
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID().obj().get());
+ if(pHeadTail)
+ {
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
+ if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
+ {
+ return pPageHint->GetPageNumber();
+ }
+ }
+
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdivinfo.hxx b/lotuswordpro/source/filter/lwpdivinfo.hxx
new file mode 100644
index 000000000..e1fea74c0
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdivinfo.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDIVINFO_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDIVINFO_HXX
+
+#include <config_lgpl.h>
+
+#include <lwpobj.hxx>
+#include <lwpobjid.hxx>
+#include <lwpatomholder.hxx>
+#include <lwpcolor.hxx>
+
+#define STR_OleDivisionClassName "OLEDivision"
+
+class LwpDivInfo : public LwpObject
+{
+public:
+ LwpDivInfo(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ LwpObjectID& GetInitialLayoutID() { return m_InitialLayoutID; }
+ LwpObjectID& GetFillerPageTextID() { return m_FillerPageTextID; }
+ OUString const & GetDivName() const { return m_Name.str(); }
+
+ OUString const & GetClassName() const { return m_ClassName.str(); }
+ inline bool HasContents() const;
+ inline bool IsOleDivision() const;
+ inline bool IsScrollable() const;
+ inline bool IsGotoable() const;
+ void GetNumberOfPages(sal_uInt16& nPageno);
+ sal_uInt16 GetMaxNumberOfPages() const;
+protected:
+ void Read() override;
+private:
+ virtual ~LwpDivInfo() override;
+
+ LwpObjectID m_ParentID;
+ LwpAtomHolder m_Name;
+ LwpObjectID m_LayoutID;
+ sal_uInt16 m_nFlags;
+ LwpAtomHolder m_ExternalName;
+ LwpAtomHolder m_ExternalType;
+ LwpAtomHolder m_ClassName;
+ LwpObjectID m_InitialLayoutID;
+ //pCDLVOListHeadHolder cPresInfo;
+
+ sal_uInt16 m_nPageNoStyle;
+ LwpColor m_TabColor;
+ LwpObjectID m_FillerPageTextID;
+
+ enum
+ {
+ DI_SCROLLABLE = 0x01,
+ DI_HASCONTENTS = 0x02,
+ DI_EXPANDED = 0x04,
+ DI_SHOWSTAB = 0x08,
+
+ DI_MUDPUPPY = 0x10,
+ DI_NOTDELETABLE = 0x20,
+ DI_BEGINGROUP = 0x40,
+ DI_GROUP = 0x80,
+
+ DI_ENDGROUP = 0x100,
+ DI_SUPPRESS_FILLER_PAGE_HEADERS = 0x200,
+ DI_EXTERNALFILE = 0x400,
+ DI_FIXED = 0x800,
+
+ DI_KNOWIFANYOLEDDELINKS = 0x1000,
+ DI_ANYOLEDDELINKS = 0x2000
+ };
+
+ void SkipFront();
+
+};
+
+inline bool LwpDivInfo::HasContents() const
+{
+ return (m_nFlags & DI_HASCONTENTS) != 0;
+}
+
+inline bool LwpDivInfo::IsOleDivision() const
+{
+ OUString strClassName = GetClassName();
+ if (strClassName == STR_OleDivisionClassName)
+ return true;
+ return false;
+}
+
+inline bool LwpDivInfo::IsScrollable() const
+{
+ return (m_nFlags & DI_SCROLLABLE) != 0;
+}
+
+inline bool LwpDivInfo::IsGotoable() const
+{
+ return HasContents() && (IsScrollable() || IsOleDivision());
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdivopts.cxx b/lotuswordpro/source/filter/lwpdivopts.cxx
new file mode 100644
index 000000000..bb52f28f1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdivopts.cxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpdivopts.hxx"
+#include <lwpfilehdr.hxx>
+
+LwpHyphenOptions::LwpHyphenOptions()
+ : m_nFlags(0)
+ , m_nZoneBefore(0)
+ , m_nZoneAfter(0)
+ , m_nMaxLines(0)
+{
+}
+
+LwpHyphenOptions::~LwpHyphenOptions()
+{}
+
+void LwpHyphenOptions::Read(LwpObjectStream *pStrm)
+{
+ m_nFlags = pStrm->QuickReaduInt16();
+ m_nZoneBefore = pStrm->QuickReaduInt16();
+ m_nZoneAfter = pStrm->QuickReaduInt16();
+ m_nMaxLines = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+
+LwpTextLanguage::LwpTextLanguage()
+ : m_nLanguage(0)
+{
+}
+
+LwpTextLanguage::~LwpTextLanguage(){}
+
+void LwpTextLanguage::Read(LwpObjectStream *pStrm)
+{
+ m_nLanguage = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+
+ if( LwpFileHeader::m_nFileRevision <= 0x0a)
+ m_nLanguage = ConvertFrom96(m_nLanguage);
+}
+
+sal_uInt16 LwpTextLanguage::ConvertFrom96(sal_uInt16 orgLang)
+{
+ // Reading a Word Pro 96 into Word Pro 97
+ switch (orgLang)
+ {
+ case 0x2809U: // AMI_MEDICAL 96
+ orgLang = 0x8409U; //0x8409U 97
+ break;
+ case 0x2C09U: // AMI_BRMEDICAL 96
+ orgLang = 0x8809U; // 0x8809U 97
+ break;
+ case 0x3409U: // AMI_BRITISHMEDIZE 96
+ orgLang = 0x8C09U; // 0x8C09U 97
+ break;
+ case 0x3009U: // AMI_BRITISHIZE 96
+ orgLang = 0x1009U; // 0x1009U 97
+ break;
+ case 0x819U: // AMI_RUSSIANIO 96
+ orgLang = 0x8419U; // 0x8419U 97
+ break;
+ }
+ return orgLang;
+}
+
+LwpDivisionOptions::LwpDivisionOptions(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+ , m_nOptionFlag(0)
+{
+}
+
+LwpDivisionOptions::~LwpDivisionOptions()
+{}
+
+void LwpDivisionOptions::Read()
+{
+ m_HyphOpts.Read(m_pObjStrm.get());
+ m_nOptionFlag = m_pObjStrm->QuickReaduInt16();
+ m_Lang.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdivopts.hxx b/lotuswordpro/source/filter/lwpdivopts.hxx
new file mode 100644
index 000000000..1d271f8d7
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdivopts.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDIVOPTS_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDIVOPTS_HXX
+
+#include <config_lgpl.h>
+
+#include <lwpobj.hxx>
+
+class LwpHyphenOptions
+{
+public:
+ LwpHyphenOptions();
+ ~LwpHyphenOptions();
+ void Read(LwpObjectStream *pStrm);
+private:
+ sal_uInt16 m_nFlags;
+ sal_uInt16 m_nZoneBefore;
+ sal_uInt16 m_nZoneAfter;
+ sal_uInt16 m_nMaxLines;
+};
+
+/*
+Text language.
+This class which holds identifiers for language and dialect.
+DESCRIPTION You can mark text as being a certain language. When we spell
+ check or grammar check we'll use this info to determine which dictionary
+ to use.
+ The only reserved value is 0, which means "default language". The
+ default language is specified by the document.
+*/
+class LwpTextLanguage
+{
+public:
+ LwpTextLanguage();
+ ~LwpTextLanguage();
+ void Read(LwpObjectStream *pStrm);
+private:
+ static sal_uInt16 ConvertFrom96(sal_uInt16 orgLang);
+ sal_uInt16 m_nLanguage;
+};
+
+class LwpDivisionOptions : public LwpObject
+{
+public:
+ LwpDivisionOptions(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+protected:
+ void Read() override;
+private:
+ virtual ~LwpDivisionOptions() override;
+
+ LwpHyphenOptions m_HyphOpts;
+ sal_uInt16 m_nOptionFlag;
+ LwpTextLanguage m_Lang;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdlvlist.cxx b/lotuswordpro/source/filter/lwpdlvlist.cxx
new file mode 100644
index 000000000..77431cdd0
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdlvlist.cxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * list class implementation
+ ************************************************************************/
+
+#include "lwpdlvlist.hxx"
+#include <lwpfilehdr.hxx>
+#include "lwpproplist.hxx"
+
+LwpDLVList::LwpDLVList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+{}
+/**
+ * @descr Read LwpDLVList data from object stream
+ **/
+void LwpDLVList::Read()
+{
+ LwpObjectStream* pObjStrm = m_pObjStrm.get();
+ m_ListNext.ReadIndexed(pObjStrm);
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ pObjStrm->SkipExtra();
+
+ m_ListPrevious.ReadIndexed(pObjStrm);
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ pObjStrm->SkipExtra();
+
+}
+LwpDLNFVList::LwpDLNFVList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm)
+{}
+/**
+ * @descr Read LwpDLNFVList data from object stream
+ **/
+void LwpDLNFVList::Read()
+{
+ LwpDLVList::Read();
+
+ LwpObjectStream* pObjStrm = m_pObjStrm.get();
+
+ m_ChildHead.ReadIndexed(pObjStrm);
+ if( LwpFileHeader::m_nFileRevision < 0x0006 || !m_ChildHead.IsNull() )
+ m_ChildTail.ReadIndexed(pObjStrm);
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ pObjStrm->SkipExtra();
+
+ m_Parent.ReadIndexed(pObjStrm);
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ pObjStrm->SkipExtra();
+
+ ReadName(pObjStrm);
+}
+/**
+ * @descr Read name of LwpDLNFVList from object stream
+ **/
+void LwpDLNFVList::ReadName(LwpObjectStream* pObjStrm)
+{
+ m_Name.Read(pObjStrm);
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ pObjStrm->SkipExtra();
+}
+/**
+ * @descr ctor of LwpDLNFPVList from object stream
+ * Note that m_bHasProperties is initialized to true
+ **/
+LwpDLNFPVList::LwpDLNFPVList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLNFVList(objHdr, pStrm),
+ m_bHasProperties(true)
+{}
+/**
+ * @descr Read name of LwpDLNFVList from object stream
+ **/
+void LwpDLNFPVList::Read()
+{
+ LwpDLNFVList::Read();
+
+ LwpObjectStream* pObjStrm = m_pObjStrm.get();
+ ReadPropertyList(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+/**
+ * @descr Read property list
+ **/
+void LwpDLNFPVList::ReadPropertyList(LwpObjectStream* pObjStrm)
+{
+ if( LwpFileHeader::m_nFileRevision >= 0x0000B)
+ {
+ m_bHasProperties = pObjStrm->QuickReaduInt8() != 0;
+ if (m_bHasProperties)
+ {
+ m_pPropList.reset( new LwpPropList );
+ m_pPropList->Read(pObjStrm);
+ }
+ }
+}
+/**
+ * @descr release property list
+ **/
+LwpDLNFPVList::~LwpDLNFPVList()
+{
+}
+
+/**
+ * @descr Read head id and tail id
+ **/
+void LwpDLVListHeadTail::Read(LwpObjectStream* pObjStrm)
+{
+ m_ListHead.ReadIndexed(pObjStrm);
+ if( (LwpFileHeader::m_nFileRevision < 0x0006) || !m_ListHead.IsNull())
+ {
+ m_ListTail.ReadIndexed(pObjStrm);
+ }
+ if( LwpFileHeader::m_nFileRevision < 0x0006)
+ {
+ pObjStrm->SkipExtra();
+ }
+}
+/**
+ * @descr Read head id
+ **/
+void LwpDLVListHead::Read(LwpObjectStream* pObjStrm)
+{
+ m_objHead.ReadIndexed(pObjStrm);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdlvlist.hxx b/lotuswordpro/source/filter/lwpdlvlist.hxx
new file mode 100644
index 000000000..19f8ff7a5
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdlvlist.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * list related class
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDLVLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDLVLIST_HXX
+
+#include <lwpatomholder.hxx>
+#include <lwpobj.hxx>
+#include <memory>
+
+/**
+ * @brief Double Linked Virtual List
+ */
+class LwpDLVList : public LwpObject
+{
+public:
+ LwpDLVList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ LwpObjectID& GetNext() { return m_ListNext; }
+ LwpObjectID& GetPrevious() { return m_ListPrevious; }
+protected:
+ virtual ~LwpDLVList() override {}
+ void Read() override;
+private:
+ LwpObjectID m_ListPrevious;
+ LwpObjectID m_ListNext;
+};
+
+/**
+ * @brief Double Linked Named Family Virtual List
+ */
+class LwpDLNFVList : public LwpDLVList
+{
+public:
+ LwpDLNFVList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+protected:
+ virtual ~LwpDLNFVList() override {}
+
+ LwpObjectID m_ChildHead;
+ LwpObjectID m_ChildTail;
+ LwpObjectID m_Parent;
+ LwpAtomHolder m_Name;
+protected:
+ void Read() override;
+ void ReadName(LwpObjectStream* pObjStrm);
+public:
+ LwpAtomHolder& GetName() { return m_Name; }
+ LwpObjectID& GetChildHead() { return m_ChildHead; }
+ LwpObjectID& GetChildTail() { return m_ChildTail; }
+ LwpObjectID& GetParent() { return m_Parent; }
+};
+
+
+class LwpPropList;
+/**
+ * @brief Double Linked Named Family Properties Virtual List
+*/
+class LwpDLNFPVList : public LwpDLNFVList
+{
+public:
+ LwpDLNFPVList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpDLNFPVList() override;
+ LwpPropList* GetPropList() { return m_pPropList.get(); }
+protected:
+ void Read() override;
+ void ReadPropertyList(LwpObjectStream* pObjStrm);
+private:
+ bool m_bHasProperties;
+ std::unique_ptr<LwpPropList> m_pPropList;
+};
+
+/**
+ * @brief Double Linked Virtual List Head Tail
+*/
+class LwpDLVListHeadTail
+{
+public:
+ LwpDLVListHeadTail(){}
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpObjectID m_ListHead;
+ LwpObjectID m_ListTail;
+public:
+ LwpObjectID& GetHead() { return m_ListHead; }
+ LwpObjectID& GetTail() { return m_ListTail; }
+};
+
+/**
+ * @brief Double Linked Virtual List Head
+*/
+class LwpDLVListHead
+{
+public:
+ LwpDLVListHead(){}
+ void Read(LwpObjectStream* pObjStrm);
+ LwpObjectID& GetFirst() { return m_objHead; }
+private:
+ LwpObjectID m_objHead;//LwpDLVList
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
new file mode 100644
index 000000000..3c887fdb8
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -0,0 +1,830 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpglobalmgr.hxx>
+#include "lwpdoc.hxx"
+#include "lwpfootnote.hxx"
+#include "lwppagehint.hxx"
+#include "lwpdivinfo.hxx"
+#include "lwpholder.hxx"
+#include "lwpparastyle.hxx"
+#include "lwpstory.hxx"
+#include "lwppara.hxx"
+#include "lwpsilverbullet.hxx"
+#include "lwpsortopt.hxx"
+#include "lwplayout.hxx"
+#include "lwppagelayout.hxx"
+#include "lwpuidoc.hxx"
+#include "lwpusrdicts.hxx"
+#include "lwpprtinfo.hxx"
+#include "lwpverdocument.hxx"
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <osl/thread.h>
+#include <o3tl/sorted_vector.hxx>
+
+LwpDocument::LwpDocument(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpDLNFPVList(objHdr, pStrm)
+ , m_bGettingFirstDivisionWithContentsThatIsNotOLE(false)
+ , m_bGettingPreviousDivisionWithContents(false)
+ , m_bGettingGetLastDivisionWithContents(false)
+ , m_nFlags(0)
+ , m_nPersistentFlags(0)
+{
+}
+
+LwpDocument::~LwpDocument()
+{
+}
+/**
+ * @descr Read VO_Document from object stream
+ **/
+void LwpDocument::Read()
+{
+ LwpDLNFPVList::Read();
+
+ ReadPlug();
+
+ m_nPersistentFlags = m_pObjStrm->QuickReaduInt32();
+
+ //Skip the SortOption and UIDocument
+ {
+ LwpSortOption aDocSort( m_pObjStrm.get() );
+ LwpUIDocument aUIDoc( m_pObjStrm.get() );
+ }
+
+ m_xLnOpts.reset(new LwpLineNumberOptions(m_pObjStrm.get()));
+
+ //Skip LwpUserDictFiles
+ {
+ LwpUserDictFiles aUsrDicts( m_pObjStrm.get() );
+ }
+
+ if( !IsChildDoc())
+ {
+ //Skip LwpPrinterInfo
+ LwpPrinterInfo aPrtInfo( m_pObjStrm.get() );
+ }
+
+ m_xOwnedFoundry.reset(new LwpFoundry(m_pObjStrm.get(), this));
+
+ m_DivOpts.ReadIndexed(m_pObjStrm.get());
+
+ if(!IsChildDoc())
+ {
+ m_FootnoteOpts.ReadIndexed(m_pObjStrm.get());
+ m_DocData.ReadIndexed(m_pObjStrm.get());
+ }
+ else
+ {
+ //Skip the docdata used in old version
+ LwpObjectID dummyDocData;
+ dummyDocData.ReadIndexed(m_pObjStrm.get());
+ }
+ m_DivInfo.ReadIndexed(m_pObjStrm.get());
+ m_Epoch.Read(m_pObjStrm.get());
+ m_WYSIWYGPageHints.ReadIndexed(m_pObjStrm.get());
+ m_VerDoc.ReadIndexed(m_pObjStrm.get());
+ m_STXInfo.ReadIndexed(m_pObjStrm.get());
+}
+
+/**
+ * @descr Read plug related data from m_pObjStram
+ **/
+void LwpDocument::ReadPlug()
+{
+ m_DocSockID.ReadIndexed(m_pObjStrm.get());
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Parse obj to IXFStream
+ **/
+void LwpDocument::Parse(IXFStream* pOutputStream)
+{
+ //check the name and skip script division
+ if (!IsSkippedDivision())
+ {
+ //the frames which anchor are to page must output before other contents
+ ParseFrameInPage(pOutputStream);
+ ParseDocContent(pOutputStream);
+ }
+
+ rtl::Reference<LwpObject> pDocSock = GetSocket().obj( VO_DOCSOCK );
+ if(pDocSock.is())
+ {
+ pDocSock->DoParse(pOutputStream);
+ }
+}
+
+bool LwpDocument::IsSkippedDivision()
+{
+ OUString sDivName;
+ bool ret = false;
+ LwpDivInfo* pDiv = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj(VO_DIVISIONINFO).get());
+ if (pDiv == nullptr)
+ return true;
+ sDivName = pDiv->GetDivName();
+ if (!sDivName.isEmpty() && !pDiv->IsGotoable()) //including toa,scripts division
+ return true;
+ //skip endnote division
+ OUString strClassName = pDiv->GetClassName();
+ if ((strClassName == STR_DivisionEndnote)
+ || (strClassName == STR_DivisionGroupEndnote)
+ || (strClassName == STR_DocumentEndnote))
+ {
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDiv->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
+ if(pPageLayout)
+ {
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent().obj(VO_STORY).get());
+ if(pStory)
+ {
+ //This judgement maybe have problem. If there is only one para in the story,
+ //this endnote division has no other contents except endnote table.
+ LwpObjectID& rFirst = pStory->GetFirstPara();
+ LwpObjectID& rLast = pStory->GetLastPara();
+ if(rFirst == rLast)
+ ret = true;
+ }
+ }
+ }
+ return ret;
+}
+
+/**
+ * @descr Register all styles in this division
+ */
+void LwpDocument::RegisterStyle()
+{
+ RegisterDefaultParaStyles();
+ RegisterGraphicsStyles();
+ RegisterBulletStyles();
+
+ RegisterTextStyles();
+ RegisterLayoutStyles();
+ RegisterStylesInPara();
+
+ RegisterLinenumberStyles();
+ RegisterFootnoteStyles();
+
+ //Register styles in other document connected with this document: next doc, children doc
+ rtl::Reference<LwpObject> pDocSock = GetSocket().obj();
+ if(pDocSock.is())
+ {
+ pDocSock->DoRegisterStyle();
+ }
+}
+/**
+ * @descr Register all named para styles
+ */
+void LwpDocument::RegisterTextStyles()
+{
+ //Register all text styles: para styles, character styles
+ LwpDLVListHeadHolder* pParaStyleHolder = m_xOwnedFoundry
+ ? dynamic_cast<LwpDLVListHeadHolder*>(m_xOwnedFoundry->GetTextStyleHead().obj().get())
+ : nullptr;
+ if(pParaStyleHolder)
+ {
+ LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
+ while(pParaStyle)
+ {
+ if (pParaStyle->GetFoundry())
+ throw std::runtime_error("loop in register text style");
+ pParaStyle->SetFoundry(m_xOwnedFoundry.get());
+ pParaStyle->RegisterStyle();
+ pParaStyle = dynamic_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
+ }
+ }
+ ChangeStyleName();//for click here block
+}
+/**
+ * @descr Register all layouts styles (page master and master page)
+ * All para styles used in master page (header and footer) are registered and then showed
+ */
+void LwpDocument::RegisterLayoutStyles()
+{
+ if (m_xOwnedFoundry)
+ {
+ //Register all layout styles, before register all styles in para
+ m_xOwnedFoundry->RegisterAllLayouts();
+ }
+
+ //set initial pagelayout in story for parsing pagelayout
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
+ if (!pDivInfo)
+ return;
+
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
+ if(pPageLayout)
+ {
+ //In Ole division, the content of pagelayout is VO_OLEOBJECT
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent().obj(VO_STORY).get());
+ if(pStory)
+ {
+ //add all the pagelayout in order into the pagelayout list;
+ pStory->SortPageLayout();
+ pStory->SetCurrentLayout(pPageLayout);
+ }
+ }
+}
+/**
+ * @descr Register all styles used in para
+ */
+void LwpDocument::RegisterStylesInPara()
+{
+ //Register all automatic styles in para
+ rtl::Reference<LwpHeadContent> xContent(m_xOwnedFoundry
+ ? dynamic_cast<LwpHeadContent*> (m_xOwnedFoundry->GetContentManager().GetContentList().obj().get())
+ : nullptr);
+ if (!xContent.is())
+ return;
+
+ rtl::Reference<LwpStory> xStory(dynamic_cast<LwpStory*>(xContent->GetChildHead().obj(VO_STORY).get()));
+ o3tl::sorted_vector<LwpStory*> aSeen;
+ while (xStory.is())
+ {
+ aSeen.insert(xStory.get());
+ //Register the child para
+ xStory->SetFoundry(m_xOwnedFoundry.get());
+ xStory->DoRegisterStyle();
+ xStory.set(dynamic_cast<LwpStory*>(xStory->GetNext().obj(VO_STORY).get()));
+ if (aSeen.find(xStory.get()) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+}
+/**
+ * @descr Register all bullet styles used in this division
+ */
+void LwpDocument::RegisterBulletStyles()
+{
+ if (!m_xOwnedFoundry)
+ return;
+ //Register bullet styles
+ LwpDLVListHeadHolder* pBulletHead = dynamic_cast<LwpDLVListHeadHolder*>
+ (m_xOwnedFoundry->GetBulletManagerID().obj(VO_HEADHOLDER).get());
+ if (!pBulletHead)
+ return;
+ LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
+ (pBulletHead->GetHeadID().obj().get());
+ o3tl::sorted_vector<LwpSilverBullet*> aSeen;
+ while (pBullet)
+ {
+ aSeen.insert(pBullet);
+ pBullet->SetFoundry(m_xOwnedFoundry.get());
+ pBullet->RegisterStyle();
+ pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
+ if (aSeen.find(pBullet) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+}
+/**
+ * @descr Register all styles used in VO_Graphic
+ */
+void LwpDocument::RegisterGraphicsStyles()
+{
+ if (!m_xOwnedFoundry)
+ return;
+ //Register all graphics styles, the first object should register the next;
+ rtl::Reference<LwpObject> pGraphic = m_xOwnedFoundry->GetGraphicListHead().obj(VO_GRAPHIC);
+ if (!pGraphic.is())
+ return;
+ pGraphic->SetFoundry(m_xOwnedFoundry.get());
+ pGraphic->DoRegisterStyle();
+}
+/**
+ * @descr Register line number styles
+ */
+void LwpDocument::RegisterLinenumberStyles()
+{
+ if (!m_xLnOpts)
+ return;
+ m_xLnOpts->RegisterStyle();
+}
+
+/**
+* @descr Register footnote/endnote configuration for the entire document
+*/
+void LwpDocument::RegisterFootnoteStyles()
+{
+ //Register footnote and endnote configuration for the entire document
+ if(!m_FootnoteOpts.IsNull())
+ {
+ LwpFootnoteOptions* pFootnoteOpts = dynamic_cast<LwpFootnoteOptions*>(m_FootnoteOpts.obj().get());
+ if (pFootnoteOpts)
+ {
+ pFootnoteOpts->SetMasterPage("Endnote");
+ pFootnoteOpts->RegisterStyle();
+ }
+ }
+ //Register endnote page style for endnote configuration, use the last division that has endnote for the endnote page style
+ //This page style must register after its division default styles have registered
+ LwpDocument* pEndnoteDiv = GetLastDivisionThatHasEndnote();
+ if(this != pEndnoteDiv)
+ return;
+
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID().obj().get());
+ if(!pHeadTail)
+ return;
+
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
+ if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
+ {
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID().obj().get());
+ if(pPageLayout)
+ {
+ pPageLayout->SetFoundry(GetFoundry());
+ pPageLayout->RegisterEndnoteStyle();
+ }
+ }
+}
+
+/**
+* @descr Register default para styles
+*/
+void LwpDocument::RegisterDefaultParaStyles()
+{
+ if(IsChildDoc())
+ return;
+
+ //Get First Division
+ //LwpDocument* pFirstDoc = GetFirstDivision();
+ LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
+ if(pFirstDoc)
+ {
+ LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc().obj().get());
+ if(pVerDoc)
+ {
+ pVerDoc->RegisterStyle();
+ }
+ }
+}
+
+/**
+ * @descr Parse content in this division to IXFStream
+ * LwpDocument->LwpDivInfo->LwpPageLayout.Parse()
+ */
+void LwpDocument::ParseDocContent(IXFStream* pOutputStream)
+{
+ //Parse content in PageLayout
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj().get());
+ if(pDivInfo==nullptr) return;
+
+ rtl::Reference<LwpObject> pLayoutObj = pDivInfo->GetInitialLayoutID().obj();
+ if(!pLayoutObj.is())
+ {
+ //master document not supported now.
+ return;
+ }
+ pLayoutObj->SetFoundry(m_xOwnedFoundry.get());
+ pLayoutObj->DoParse(pOutputStream);
+}
+
+/**
+ * @descr Get the footnoteoptions from the root document
+ */
+LwpObjectID* LwpDocument::GetValidFootnoteOpts()
+{
+ LwpDocument* pRoot = GetRootDocument();
+ if(pRoot)
+ {
+ return &pRoot->GetFootnoteOpts();
+ }
+ return nullptr;
+}
+
+/**
+ * @descr Get the endnote type
+ */
+sal_uInt16 LwpDocument::GetEndnoteType()
+{
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj().get());
+ if (!pDivInfo)
+ return FN_DONTCARE;
+ OUString strClassName = pDivInfo->GetClassName();
+ if (strClassName == STR_DivisionEndnote)
+ return FN_DIVISION_SEPARATE;
+ if (strClassName == STR_DivisionGroupEndnote)
+ return FN_DIVISIONGROUP_SEPARATE;
+ if (strClassName == STR_DocumentEndnote)
+ return FN_DOCUMENT_SEPARATE;
+ return FN_DONTCARE;
+}
+/**
+ * @descr Get previous division
+ */
+LwpDocument* LwpDocument::GetPreviousDivision()
+{
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket().obj().get());
+ if(pDocSock)
+ {
+ return dynamic_cast<LwpDocument*>(pDocSock->GetPrevious().obj().get());
+ }
+ return nullptr;
+}
+/**
+ * @descr Get next division
+ */
+ LwpDocument* LwpDocument::GetNextDivision()
+{
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket().obj().get());
+ if(pDocSock)
+ {
+ return dynamic_cast<LwpDocument*>(pDocSock->GetNext().obj().get());
+ }
+ return nullptr;
+}
+/**
+ * @descr Get parent division
+ */
+ LwpDocument* LwpDocument::GetParentDivision()
+{
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket().obj().get());
+ if(pDocSock)
+ {
+ return dynamic_cast<LwpDocument*>(pDocSock->GetParent().obj().get());
+ }
+ return nullptr;
+}
+/**
+ * @descr Get previous division in group, copy from lwp source code
+ */
+ LwpDocument* LwpDocument::GetPreviousInGroup()
+{
+ LwpDocument* pPrev = nullptr;
+
+ for (pPrev = GetPreviousDivision(); pPrev; pPrev = pPrev->GetPreviousDivision())
+ {
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pPrev->GetDivInfoID().obj().get());
+ if(pDivInfo && pDivInfo->HasContents())
+ return pPrev;
+ }
+ return nullptr;
+}
+/**
+ * @descr Get previous division in group, copy from lwp source code
+ */
+ LwpDocument* LwpDocument::GetNextInGroup()
+{
+ LwpDocument* pNext = nullptr;
+
+ for (pNext = GetNextDivision(); pNext; pNext = pNext->GetNextDivision())
+ {
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID().obj().get());
+ if(pDivInfo && pDivInfo->HasContents())
+ return pNext;
+ }
+
+ return nullptr;
+}
+/**
+ * @descr Get previous division which has contents, copy from lwp source code
+ */
+LwpDocument* LwpDocument::GetPreviousDivisionWithContents()
+{
+ if (m_bGettingPreviousDivisionWithContents)
+ throw std::runtime_error("recursion in page divisions");
+ m_bGettingPreviousDivisionWithContents = true;
+ LwpDocument* pRet = nullptr;
+
+ if (GetPreviousDivision())
+ pRet = GetPreviousDivision()->GetLastDivisionWithContents();
+ if (!pRet && GetParentDivision())
+ pRet = GetParentDivision()->GetPreviousDivisionWithContents();
+
+ m_bGettingPreviousDivisionWithContents = false;
+ return pRet;
+}
+
+/**
+* @descr Get last division which has contents, copy from lwp source code
+*/
+LwpDocument* LwpDocument::GetLastDivisionWithContents()
+{
+ if (m_bGettingGetLastDivisionWithContents)
+ throw std::runtime_error("recursion in page divisions");
+ m_bGettingGetLastDivisionWithContents = true;
+ LwpDocument* pRet = nullptr;
+
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj().get());
+ if (pDivInfo && pDivInfo->HasContents())
+ pRet = this;
+
+ if (!pRet)
+ {
+ LwpDocument* pDivision = GetLastDivision();
+
+ o3tl::sorted_vector<LwpDocument*> aSeen;
+ while (pDivision && pDivision != this)
+ {
+ aSeen.insert(pDivision);
+ LwpDocument* pContentDivision = pDivision->GetLastDivisionWithContents();
+ if (pContentDivision)
+ {
+ pRet = pContentDivision;
+ break;
+ }
+ pDivision = pDivision->GetPreviousDivision();
+ if (aSeen.find(pDivision) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ }
+
+ m_bGettingGetLastDivisionWithContents = false;
+ return pRet;
+}
+ /**
+ * @descr Get last division in group which has contents, copy from lwp source code
+ */
+ LwpDocument* LwpDocument::GetLastInGroupWithContents()
+{
+ LwpDocument* pLast = nullptr;
+ LwpDocument* pNext = this;
+
+ while (pNext)
+ {
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID().obj().get());
+ if (pDivInfo && pDivInfo->HasContents())
+ pLast = pNext;
+ pNext = pNext->GetNextInGroup();
+ }
+ if (pLast)
+ return pLast;
+ return nullptr;
+}
+ /**
+ * @descr Get last division
+ */
+ LwpDocument* LwpDocument::GetLastDivision()
+{
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket().obj().get());
+ if(pDocSock)
+ return dynamic_cast<LwpDocument*>(pDocSock->GetChildTail().obj().get());
+ return nullptr;
+}
+
+ /**
+ * @descr Get first division
+ */
+ LwpDocument* LwpDocument::GetFirstDivision()
+{
+ LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket().obj().get());
+ if(pDocSock)
+ return dynamic_cast<LwpDocument*>(pDocSock->GetChildHead().obj().get());
+ return nullptr;
+}
+
+ /**
+ * @descr Get root document
+ */
+ LwpDocument* LwpDocument::GetRootDocument()
+{
+ LwpDocument* pRoot = this;
+ o3tl::sorted_vector<LwpDocument*> aSeen;
+ while (pRoot)
+ {
+ aSeen.insert(pRoot);
+ if(!pRoot->IsChildDoc())
+ return pRoot;
+ pRoot = pRoot->GetParentDivision();
+ if (aSeen.find(pRoot) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ return nullptr;
+}
+ /**
+ * @descr Get first division with contents that is not ole, copy from lwp-source code
+ */
+ LwpDocument* LwpDocument::ImplGetFirstDivisionWithContentsThatIsNotOLE()
+{
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj().get());
+ if(pDivInfo && pDivInfo->HasContents()
+ && !pDivInfo->IsOleDivision())
+ return this;
+
+ LwpDocument* pDivision = GetFirstDivision();
+ o3tl::sorted_vector<LwpDocument*> aSeen;
+ while (pDivision)
+ {
+ aSeen.insert(pDivision);
+ LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
+ if (pContentDivision)
+ return pContentDivision;
+ pDivision = pDivision->GetNextDivision();
+ if (aSeen.find(pDivision) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ return nullptr;
+}
+ /**
+ * @descr Get last division that has endnote
+ */
+ LwpDocument* LwpDocument::GetLastDivisionThatHasEndnote()
+{
+ LwpDocument* pRoot = GetRootDocument();
+ LwpDocument *pLastDoc = pRoot ? pRoot->GetLastDivisionWithContents() : nullptr;
+ o3tl::sorted_vector<LwpDocument*> aSeen;
+ while (pLastDoc)
+ {
+ aSeen.insert(pLastDoc);
+ if (pLastDoc->GetEnSuperTableLayout().is())
+ return pLastDoc;
+ pLastDoc = pLastDoc->GetPreviousDivisionWithContents();
+ if (aSeen.find(pLastDoc) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ return nullptr;
+
+}
+ /**
+ * @descr Get endnote supertable layout, every division has only one endnote supertable layout.
+ */
+rtl::Reference<LwpVirtualLayout> LwpDocument::GetEnSuperTableLayout()
+{
+ LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout().obj().get());
+ if(pHeadLayout)
+ {
+ return pHeadLayout->FindEnSuperTableLayout();
+ }
+ return rtl::Reference<LwpVirtualLayout>();
+}
+
+/**
+ * @descr Get the numbers of page before pEndDivision, copy from lwp source code
+ */
+bool LwpDocument::GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount)
+{
+ if(this == pEndDivision)
+ return true;
+
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj().get());
+ if(pDivInfo)
+ {
+ pDivInfo->GetNumberOfPages(nCount);
+ }
+
+ LwpDocument* pDivision = GetFirstDivision();
+ while(pDivision)
+ {
+ if(pDivision->GetNumberOfPages(pEndDivision,nCount))
+ return true;
+ pDivision = pDivision->GetNextDivision();
+
+ }
+ return false;
+}
+/**
+ * @descr Get the numbers of page before current division
+ */
+sal_uInt16 LwpDocument::GetNumberOfPagesBefore()
+{
+ sal_uInt16 nPageNumber = 0;
+ LwpDocument* pRoot = GetRootDocument();
+ if(pRoot)
+ pRoot->GetNumberOfPages(this,nPageNumber);
+ return nPageNumber;
+}
+
+ /**
+ * @descr Parse the frame which anchor is to page before parse other contents,
+ * This method is called when the document is root document.
+ */
+void LwpDocument::ParseFrameInPage(IXFStream * pOutputStream)
+{
+ if (IsChildDoc())
+ return;
+
+ rtl::Reference<XFContentContainer> xXFContainer(new XFContentContainer);
+ XFConvertFrameInPage(xXFContainer.get());
+ xXFContainer->ToXml(pOutputStream);
+}
+
+ /**
+ * @descr Parse the frame which anchor is to page in the entire document
+ */
+void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont)
+{
+ LwpDocument* pDivision = GetFirstDivision();
+
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (GetDivInfoID().obj().get());
+ if(pDivInfo)
+ {
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj().get());
+ if(pPageLayout)
+ {
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent().obj().get());
+ if(pStory)
+ pStory->XFConvertFrameInPage(pCont);
+ }
+ }
+ while(pDivision)
+ {
+ pDivision->XFConvertFrameInPage(pCont);
+ pDivision = pDivision->GetNextDivision();
+ }
+}
+ /**
+ * @descr change click here to placeholder
+ */
+void LwpDocument::ChangeStyleName()
+{
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFTextStyle* pStyle = dynamic_cast<XFTextStyle*>(pXFStyleManager->FindStyle("ClickHere"));
+ if (pStyle)
+ {
+ pStyle->SetStyleName("Placeholder");
+ }
+}
+LwpDocSock::LwpDocSock(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ :LwpDLNFVList(objHdr, pStrm)
+{}
+
+ /**
+ * @descr read VO_DOCSOCK from file
+ */
+void LwpDocSock::Read()
+{
+ LwpDLNFVList::Read();
+ m_Doc.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+ /**
+ * @descr register styles in documents plugged
+ */
+void LwpDocSock::RegisterStyle()
+{
+ rtl::Reference<LwpObject> pDoc = GetNext().obj();
+ if(pDoc.is())
+ pDoc->DoRegisterStyle();
+
+ pDoc = GetChildHead().obj();
+ if(pDoc.is())
+ pDoc->DoRegisterStyle();
+}
+ /**
+ * @descr parse contents of documents plugged
+ */
+void LwpDocSock::Parse(IXFStream* pOutputStream)
+{
+ rtl::Reference<LwpObject> pDoc = GetChildHead().obj();
+ if(pDoc.is())
+ pDoc->DoParse(pOutputStream);
+
+ pDoc = GetNext().obj();
+ if(pDoc.is())
+ pDoc->DoParse(pOutputStream);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx
new file mode 100644
index 000000000..3e9b101db
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdoc.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * LwpDocument header file
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDOC_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDOC_HXX
+
+#include <config_lgpl.h>
+#include "lwplnopts.hxx"
+#include "lwpdlvlist.hxx"
+#include <lwpfoundry.hxx>
+
+class IXFStream;
+class LwpVirtualLayout;
+/**
+ * @brief Document object, represent document and division
+*/
+class LwpDocument : public LwpDLNFPVList
+{
+public:
+ LwpDocument(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpDocument() override;
+
+private:
+ std::unique_ptr<LwpFoundry> m_xOwnedFoundry;
+ bool m_bGettingFirstDivisionWithContentsThatIsNotOLE;
+ bool m_bGettingPreviousDivisionWithContents;
+ bool m_bGettingGetLastDivisionWithContents;
+
+ //Data members in file format
+ LwpObjectID m_DocSockID;
+ sal_uInt16 m_nFlags;
+ sal_uInt32 m_nPersistentFlags;
+ enum
+ {
+ DOC_PROTECTED = 0x00000004UL,
+ DOC_CHILDDOC = 0x00000800UL
+ };
+
+ std::unique_ptr<LwpLineNumberOptions> m_xLnOpts;
+
+ LwpObjectID m_DivOpts;
+ LwpObjectID m_FootnoteOpts;
+ LwpObjectID m_DocData;
+ LwpObjectID m_DivInfo;
+ LwpAtomHolder m_Epoch;
+
+ LwpObjectID m_WYSIWYGPageHints;
+ LwpObjectID m_VerDoc;
+ LwpObjectID m_STXInfo;
+
+protected:
+ void Read() override;
+ void ReadPlug();
+ void ParseDocContent(IXFStream* pOutputStream);
+ void RegisterTextStyles();
+ void RegisterLayoutStyles();
+
+ void RegisterStylesInPara();
+ void RegisterBulletStyles();
+ void RegisterGraphicsStyles();
+ void RegisterLinenumberStyles();
+ void RegisterFootnoteStyles();
+ void RegisterDefaultParaStyles();
+
+public:
+ void Parse(IXFStream* pOutputStream) override;
+ void RegisterStyle() override;
+
+ inline bool IsChildDoc() const;
+ inline bool GetHonorProtection() const;
+ inline LwpObjectID& GetDocData();
+ inline LwpObjectID& GetSocket();
+
+ inline LwpFoundry* GetFoundry();
+ inline LwpObjectID& GetDivInfoID();
+ inline LwpObjectID& GetPageHintsID();
+ inline LwpObjectID& GetFootnoteOpts();
+ inline LwpObjectID& GetVerDoc();
+ LwpObjectID* GetValidFootnoteOpts();
+
+ sal_uInt16 GetEndnoteType();
+ LwpDocument* GetPreviousDivision();
+ LwpDocument* GetNextDivision();
+ LwpDocument* GetParentDivision();
+ LwpDocument* GetPreviousInGroup();
+
+ LwpDocument* GetNextInGroup();
+ LwpDocument* GetPreviousDivisionWithContents();
+ LwpDocument* GetLastDivisionWithContents();
+ LwpDocument* GetLastInGroupWithContents();
+ LwpDocument* GetRootDocument();
+ LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE()
+ {
+ if (m_bGettingFirstDivisionWithContentsThatIsNotOLE)
+ throw std::runtime_error("recursion in page divisions");
+ m_bGettingFirstDivisionWithContentsThatIsNotOLE = true;
+ LwpDocument* pRet = ImplGetFirstDivisionWithContentsThatIsNotOLE();
+ m_bGettingFirstDivisionWithContentsThatIsNotOLE = false;
+ return pRet;
+ }
+ LwpDocument* GetLastDivisionThatHasEndnote();
+
+ LwpDocument* GetLastDivision();
+ LwpDocument* GetFirstDivision();
+ rtl::Reference<LwpVirtualLayout> GetEnSuperTableLayout();
+ bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
+
+ sal_uInt16 GetNumberOfPagesBefore();
+ void ParseFrameInPage(IXFStream* pOutputStream);
+
+private:
+ LwpDocument* ImplGetFirstDivisionWithContentsThatIsNotOLE();
+ void XFConvertFrameInPage(XFContentContainer* pCont);
+ static void ChangeStyleName();
+ bool IsSkippedDivision();
+};
+
+inline bool LwpDocument::IsChildDoc() const
+{
+ return (m_nPersistentFlags & DOC_CHILDDOC) != 0;
+}
+inline bool LwpDocument::GetHonorProtection() const
+{
+ return (m_nPersistentFlags & DOC_PROTECTED) != 0;
+}
+inline LwpObjectID& LwpDocument::GetSocket()
+{
+ return m_DocSockID;
+}
+inline LwpFoundry* LwpDocument::GetFoundry()
+{
+ return m_xOwnedFoundry.get();
+}
+inline LwpObjectID& LwpDocument::GetDivInfoID()
+{
+ return m_DivInfo;
+}
+inline LwpObjectID& LwpDocument::GetPageHintsID()
+{
+ return m_WYSIWYGPageHints;
+}
+inline LwpObjectID& LwpDocument::GetFootnoteOpts()
+{
+ return m_FootnoteOpts;
+}
+inline LwpObjectID& LwpDocument::GetDocData()
+{
+ return m_DocData;
+}
+inline LwpObjectID& LwpDocument::GetVerDoc()
+{
+ return m_VerDoc;
+}
+
+/**
+ * @brief DocumentSock object, divisions are embedded by document socket object
+*/
+class LwpDocSock : public LwpDLNFVList
+{
+public:
+ LwpDocSock(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+private:
+ LwpObjectID m_Doc;
+protected:
+ void Read() override;
+public:
+ void RegisterStyle() override;
+ void Parse(IXFStream* pOutputStream) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdocdata.cxx b/lotuswordpro/source/filter/lwpdocdata.cxx
new file mode 100644
index 000000000..e88751524
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdocdata.cxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <memory>
+#include <lwpdocdata.hxx>
+#include <xfilter/xfofficemeta.hxx>
+#include <localtime.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <lwpfilehdr.hxx>
+#include <lwpglobalmgr.hxx>
+
+LwpDocData::LwpDocData(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ :LwpObject(objHdr, pStrm)//m_pEditorAttrList(0)
+{}
+
+LwpDocData::~LwpDocData()
+{
+}
+
+void LwpDocData::Read()
+{
+ //XFDateTime
+
+ //doc options
+ //cOptionFlag
+ m_DocOptions.nOptionFlag = m_pObjStrm->QuickReaduInt16();
+ //cEncrypt1Password
+ m_DocOptions.encrypt1password.Read(m_pObjStrm.get());
+ //cEncrypt2Password
+ m_DocOptions.encrypt2password.Read(m_pObjStrm.get());
+ //cCharecterSet
+ m_DocOptions.characterSet.Read(m_pObjStrm.get());
+ //cGrammerSet
+ m_DocOptions.grammerSet.Read(m_pObjStrm.get());
+ //cShowMarginMarks
+ m_DocOptions.nMarginMarks = m_pObjStrm->QuickReaduInt16();
+ //cMarginMarksLocation
+ m_DocOptions.nMarginMarksLocation = m_pObjStrm->QuickReaduInt16();
+ //cMarginMarksChar
+ m_DocOptions.nMarginMarksChar = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+
+ //doc info
+ //cDescription
+ m_DocInfo.description.Read(m_pObjStrm.get());
+ //cKeyWord
+ m_DocInfo.keywords.Read(m_pObjStrm.get());
+ //cCreatedBy
+ m_DocInfo.createdBy.Read(m_pObjStrm.get());
+ //cCreationTime
+ m_DocInfo.nCreationTime = m_pObjStrm->QuickReadInt32();
+ LtgLocalTime(m_DocInfo.nCreationTime,m_nCreationTime);
+ //cLastRevisionTime
+ m_DocInfo.nLastRevisionTime = m_pObjStrm->QuickReadInt32();
+ LtgLocalTime(m_DocInfo.nLastRevisionTime,m_nLastRevisionTime);
+ //cTotalEditTime
+ m_DocInfo.nTotalEditTime = m_pObjStrm->QuickReadInt32();
+
+ m_nTotalEditTime.tm_hour = m_DocInfo.nTotalEditTime / 60;
+ m_nTotalEditTime.tm_min = m_DocInfo.nTotalEditTime % 60;
+ m_nTotalEditTime.tm_sec = 0;
+ //cpVerDocInfo
+ m_DocInfo.cpVerDocInfo.ReadIndexed(m_pObjStrm.get());
+
+ //EditorList
+ m_DocInfo.nNumEditedBy = m_pObjStrm->QuickReaduInt16();
+ std::unique_ptr<LwpAtomHolder[]> pCDLNList(new LwpAtomHolder[m_DocInfo.nNumEditedBy]);
+ std::unique_ptr<LwpAtomHolder[]> pEditorList(new LwpAtomHolder[m_DocInfo.nNumEditedBy]);
+ sal_uInt16 i = 0;
+ for ( i = 0; i < m_DocInfo.nNumEditedBy; i++)
+ {
+ //CDLNList
+ pCDLNList[i].Read(m_pObjStrm.get()); //cName
+ m_pObjStrm->SkipExtra();
+ //CEditedBy
+ pEditorList[i].Read(m_pObjStrm.get()); //cName
+ m_pObjStrm->SkipExtra();
+ }
+
+ m_pObjStrm->SkipExtra();
+
+ pCDLNList.reset();
+ pEditorList.reset();
+
+ //doc control
+ //cGreeting
+ m_DocControl.cGreeting.Read(m_pObjStrm.get());
+ //cFlags
+ m_DocControl.nFlags = m_pObjStrm->QuickReaduInt16();
+
+ //cDocControlProtection
+ m_DocControl.nDocControlProtection = m_pObjStrm->QuickReaduInt16();
+ //Len
+ m_DocControl.nLen1 = m_pObjStrm->QuickReaduInt16();
+ //skip doc control password string
+ m_pObjStrm->SeekRel(m_DocControl.nLen1);
+
+ //cFileProtection
+ m_DocControl.nFileProtection = m_pObjStrm->QuickReaduInt16();
+ //Len
+ m_DocControl.nLen2 = m_pObjStrm->QuickReaduInt16();
+ //skip file password string
+ m_pObjStrm->SeekRel(m_DocControl.nLen2);
+
+ //cAutoVersioning
+ m_DocControl.nAutoVersioning = m_pObjStrm->QuickReaduInt16();
+ //cDocControlOnlyEditor
+ m_DocControl.cDocControlOnlyEditor.Read(m_pObjStrm.get());
+ //cEditorVerification
+ m_DocControl.nEditorVerification = m_pObjStrm->QuickReaduInt16();
+
+ m_pObjStrm->SkipExtra();
+
+ //editor list
+ //numeditors
+ sal_uInt16 numeditors = m_pObjStrm->QuickReaduInt16();
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+
+ for (i = 0;i<numeditors;i++)
+ {
+ std::unique_ptr<LwpEditorAttr> xEditorAttr(new LwpEditorAttr);
+ //cName
+ xEditorAttr->cName.Read(m_pObjStrm.get());
+ //cInitials
+ xEditorAttr->cInitials.Read(m_pObjStrm.get());
+ //cHiLite
+ xEditorAttr->cHiLiteColor.Read(m_pObjStrm.get());
+
+ //cID
+ xEditorAttr->nID = m_pObjStrm->QuickReaduInt16();
+
+ //cInsFontOver
+ //CFontAttributeOverride --cAttrBits
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrBits = m_pObjStrm->QuickReaduInt16();
+ //CFontAttributeOverride --cAttrOverrideBits
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrOverrideBits = m_pObjStrm->QuickReaduInt16();
+ //CFontAttributeOverride --cAttrApplyBits
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrApplyBits = m_pObjStrm->QuickReaduInt16();
+ //CFontAttributeOverride --cAttrOverrideBits2
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrOverrideBits2 = m_pObjStrm->QuickReaduInt8();
+ //CFontAttributeOverride --cAttrApplyBits2
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrApplyBits2 = m_pObjStrm->QuickReaduInt8();
+ //CFontAttributeOverride --cCase
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cCase = m_pObjStrm->QuickReaduInt8();
+ //CFontAttributeOverride --cUnder
+ xEditorAttr->cInsFontOver.cFontAttributeOverride.cUnder = m_pObjStrm->QuickReaduInt8();
+ m_pObjStrm->SkipExtra();
+ //CFontDescriptionOverrideBase--cOverrideBits
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cOverrideBits = m_pObjStrm->QuickReaduInt8();
+ //CFontDescriptionOverrideBase--cApplyBits
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cApplyBits = m_pObjStrm->QuickReaduInt8();
+ //CFontDescriptionOverrideBase--cPointSize
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cPointSize = m_pObjStrm->QuickReadInt32();
+ //CFontDescriptionOverrideBase--cOverstrike
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cOverstrike = m_pObjStrm->QuickReaduInt8();
+ //CFontDescriptionOverrideBase--cTightness
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cTightness = m_pObjStrm->QuickReaduInt16();
+ //CFontDescriptionOverrideBase--cColor
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cColor.Read(m_pObjStrm.get());
+
+ //CFontDescriptionOverrideBase--cBackgroundColor
+ xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cBackgroundColor.Read(m_pObjStrm.get());
+
+ m_pObjStrm->SkipExtra();
+ //cFaceName
+ xEditorAttr->cInsFontOver.cFaceName.Read(m_pObjStrm.get());
+ //cAltFaceName
+ xEditorAttr->cInsFontOver.cAltFaceName.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+
+ //cDelFontOver
+ //CFontAttributeOverride --cAttrBits
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrBits = m_pObjStrm->QuickReaduInt16();
+ //CFontAttributeOverride --cAttrOverrideBits
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrOverrideBits = m_pObjStrm->QuickReaduInt16();
+ //CFontAttributeOverride --cAttrApplyBits
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrApplyBits = m_pObjStrm->QuickReaduInt16();
+ //CFontAttributeOverride --cAttrOverrideBits2
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrOverrideBits2 = m_pObjStrm->QuickReaduInt8();
+ //CFontAttributeOverride --cAttrApplyBits2
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrApplyBits2 = m_pObjStrm->QuickReaduInt8();
+ //CFontAttributeOverride --cCase
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cCase = m_pObjStrm->QuickReaduInt8();
+ //CFontAttributeOverride --cUnder
+ xEditorAttr->cDelFontOver.cFontAttributeOverride.cUnder = m_pObjStrm->QuickReaduInt8();
+ m_pObjStrm->SkipExtra();
+ //CFontDescriptionOverrideBase--cOverrideBits
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cOverrideBits = m_pObjStrm->QuickReaduInt8();
+ //CFontDescriptionOverrideBase--cApplyBits
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cApplyBits = m_pObjStrm->QuickReaduInt8();
+ //CFontDescriptionOverrideBase--cPointSize
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cPointSize = m_pObjStrm->QuickReadInt32();
+ //CFontDescriptionOverrideBase--cOverstrike
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cOverstrike = m_pObjStrm->QuickReaduInt8();
+ //CFontDescriptionOverrideBase--cTightness
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cTightness = m_pObjStrm->QuickReaduInt16();
+ //CFontDescriptionOverrideBase--cColor
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cColor.Read(m_pObjStrm.get());
+
+ //CFontDescriptionOverrideBase--cBackgroundColor
+ xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cBackgroundColor.Read(m_pObjStrm.get());
+
+ m_pObjStrm->SkipExtra();
+ //cFaceName
+ xEditorAttr->cDelFontOver.cFaceName.Read(m_pObjStrm.get());
+ //cAltFaceName
+ xEditorAttr->cDelFontOver.cAltFaceName.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+
+ //cAbilities
+ xEditorAttr->nAbilities = m_pObjStrm->QuickReaduInt16();
+ //cLocks
+ xEditorAttr->nLocks = m_pObjStrm->QuickReaduInt16();
+ //cSuggestions
+ xEditorAttr->nSuggestions = m_pObjStrm->QuickReaduInt16();
+
+ //cDelTextAttr
+ //m_pEditorAttrList[i].cDelTextAttr.Read(m_pObjStrm);
+ if (m_pObjStrm->QuickReadBool())
+ {
+ xEditorAttr->cDelTextAttr.cOverride.cValues = m_pObjStrm->QuickReaduInt16();
+ xEditorAttr->cDelTextAttr.cOverride.cOverride = m_pObjStrm->QuickReaduInt16();
+ xEditorAttr->cDelTextAttr.cOverride.cApply = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+ xEditorAttr->cDelTextAttr.cHideLevels = m_pObjStrm->QuickReaduInt16();
+
+ if (LwpFileHeader::m_nFileRevision>= 0x000b)
+ {
+ xEditorAttr->cDelTextAttr.cBaselineOffset = m_pObjStrm->QuickReadInt32();
+ }
+ else
+ {
+ xEditorAttr->cDelTextAttr.cBaselineOffset = 0;
+ }
+ }
+ m_pObjStrm->SkipExtra();
+
+ m_pObjStrm->SkipExtra();
+
+ sal_uInt16 nID = xEditorAttr->nID;
+ pGlobal->SetEditorAttrMap(nID, xEditorAttr.release());
+ }
+}
+OUString LwpDocData::DateTimeToOUString(LtTm const & dt)
+{
+ OUString aResult = OUString::number(dt.tm_year) + "-" + OUString::number(dt.tm_mon) + "-" + OUString::number(dt.tm_mday) +
+ "T" + OUString::number(dt.tm_hour) + ":" + OUString::number(dt.tm_min) + ":" + OUString::number(dt.tm_sec) + ".0";
+
+ return aResult;
+}
+OUString LwpDocData::TimeToOUString(LtTm const & dt)
+{
+ //PT3H43M44S
+ OUString aResult = "PT" + OUString::number(dt.tm_hour) + "H" + OUString::number(dt.tm_min) + "M" + OUString::number(dt.tm_sec) + "S";
+
+ return aResult;
+}
+void LwpDocData::Parse(IXFStream *pOutputStream)
+{
+ //<!DOCTYPE office:document-meta PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "office.dtd">
+ //<office:document-meta xmlns:office="http://openoffice.org/2000/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" office:version="1.0">
+ //</office:document-meta>
+ XFOfficeMeta xfMeta;
+ xfMeta.SetCreator(m_DocInfo.createdBy.str());
+ xfMeta.SetDescription(m_DocInfo.description.str());
+ xfMeta.SetKeywords(m_DocInfo.keywords.str());
+ xfMeta.SetCreationTime(DateTimeToOUString(m_nCreationTime));
+ xfMeta.SetLastTime(DateTimeToOUString(m_nLastRevisionTime));
+ xfMeta.SetEditTime(TimeToOUString(m_nTotalEditTime));
+ xfMeta.ToXml(pOutputStream);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx
new file mode 100644
index 000000000..38e8c3162
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdrawobj.cxx
@@ -0,0 +1,1489 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * Implementation file of LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
+ * and so on.
+ */
+#include <osl/thread.h>
+#include <lwpglobalmgr.hxx>
+#include "lwpdrawobj.hxx"
+#include <lwptools.hxx>
+#include <tools/stream.hxx>
+
+#include <xfilter/xfframe.hxx>
+
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfdrawstyle.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xfimagestyle.hxx>
+#include <xfilter/xftextboxstyle.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xffont.hxx>
+
+#include <xfilter/xfdrawrect.hxx>
+#include <xfilter/xfdrawpath.hxx>
+#include <xfilter/xfdrawline.hxx>
+#include <xfilter/xfdrawpolygon.hxx>
+#include <xfilter/xfimage.hxx>
+
+#include "lwpcharsetmgr.hxx"
+#include "lwpsdwrect.hxx"
+
+/**
+ * @descr Constructor of class LwpDrawObj
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawObj::LwpDrawObj(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+ : m_eType(OT_UNDEFINED)
+ , m_pStream(pStream)
+ , m_pTransData(pTransData)
+{
+ ReadObjHeaderRecord();
+}
+
+/**
+ * @descr read the header record data of lwp-sdw-object
+ */
+void LwpDrawObj::ReadObjHeaderRecord()
+{
+ //flags
+ m_pStream->SeekRel(1);
+
+ //record Length
+ m_pStream->ReadUInt16( m_aObjHeader.nRecLen );
+
+ //boundrect
+ m_pStream->ReadInt16( m_aObjHeader.nLeft );
+ m_pStream->ReadInt16( m_aObjHeader.nTop );
+ m_pStream->ReadInt16( m_aObjHeader.nRight );
+ m_pStream->ReadInt16( m_aObjHeader.nBottom );
+
+ //nextObj, prevObj
+ m_pStream->SeekRel(4);
+}
+
+/**
+ * @descr read the style of closed lwp-sdw-object like: rectangle, ellipse and so on.
+ */
+void LwpDrawObj::ReadClosedObjStyle()
+{
+ if ((m_eType != OT_POLYGON) && (m_eType != OT_TEXTART))
+ {
+ m_pStream->SeekRel(8);
+ }
+
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.nLineWidth );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.nLineStyle );
+
+ // pen color
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.nR );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.nG );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.nB );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.unused );
+
+ // foreground color
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.nR );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.nG );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.nB );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.unused );
+
+ // background color
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.nR );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.nG );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.nB );
+ m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.unused );
+
+ // fill style
+ m_pStream->ReadUInt16( m_aClosedObjStyleRec.nFillType );
+ m_pStream->ReadBytes(m_aClosedObjStyleRec.pFillPattern,
+ sizeof(m_aClosedObjStyleRec.pFillPattern));
+}
+
+/**
+ * @descr set fill style of drawing objects
+ * @param pStyle pointer of the drawing xfstyle.
+ */
+void LwpDrawObj::SetFillStyle(XFDrawStyle* pStyle)
+{
+ if (!pStyle)
+ {
+ assert(false);
+ return;
+ }
+
+ XFColor aForeColor(m_aClosedObjStyleRec.aForeColor.nR,
+ m_aClosedObjStyleRec.aForeColor.nG, m_aClosedObjStyleRec.aForeColor.nB);
+ XFColor aBackColor(m_aClosedObjStyleRec.aBackColor.nR,
+ m_aClosedObjStyleRec.aBackColor.nG, m_aClosedObjStyleRec.aBackColor.nB);
+
+ switch (m_aClosedObjStyleRec.nFillType)
+ {
+ default: //fall through!
+ case FT_TRANSPARENT:
+ {
+ // set fill style : none
+ break;
+ }
+ case FT_SOLID:
+ {
+ pStyle->SetAreaColor(aForeColor);
+ break;
+ }
+ case FT_HORZHATCH:
+ {
+ pStyle->SetAreaColor(aBackColor);
+ pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 0, 0.12, aForeColor);
+ break;
+ }
+ case FT_VERTHATCH:
+ {
+ pStyle->SetAreaColor(aBackColor);
+ pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 90, 0.12, aForeColor);
+ break;
+ }
+ case FT_FDIAGHATCH:
+ {
+ pStyle->SetAreaColor(aBackColor);
+ pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 135, 0.09, aForeColor);
+ break;
+ }
+ case FT_BDIAGHATCH:
+ {
+ pStyle->SetAreaColor(aBackColor);
+ pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 45, 0.09, aForeColor);
+ break;
+ }
+ case FT_CROSSHATCH:
+ {
+ pStyle->SetAreaColor(aBackColor);
+ pStyle->SetAreaLineStyle(enumXFAreaLineCrossed, 0, 0.12, aForeColor);
+ break;
+ }
+ case FT_DIAGCROSSHATCH:
+ {
+ pStyle->SetAreaColor(aBackColor);
+ pStyle->SetAreaLineStyle(enumXFAreaLineCrossed, 45, 0.095, aForeColor);
+ break;
+ }
+ }
+}
+
+/**
+ * @descr set line/border style of drawing objects.
+ * @param pStyle pointer of the drawing xfstyle.
+ * @param nWidth width of line/border.
+ * @param nLineStyle flag of line/border style: none, dot or solid.
+ * @param rColor color of line/border.
+ */
+void LwpDrawObj::SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
+ const SdwColor& rColor)
+{
+ if (!pStyle)
+ {
+ assert(false);
+ return;
+ }
+ if (nWidth == 0)
+ {
+ nLineStyle = LS_NULL;
+ }
+
+ if (nLineStyle == LS_NULL)
+ {
+ // set stroke:none
+ return;
+ }
+
+ if (nLineStyle == LS_DOT)
+ {
+ pStyle->SetLineDashStyle(enumXFLineDash, 0.05, 0.05, 0.05);
+ }
+
+ // line width
+ double fWidth = static_cast<double>(nWidth)/TWIPS_PER_CM;
+
+ // line color
+ XFColor aXFColor(rColor.nR, rColor.nG, rColor.nB);
+
+ pStyle->SetLineStyle(fWidth, aXFColor);
+}
+
+/**
+ * @descr set position of a drawing object in the frame.
+ * @param pObj pointer of the xf-drawing object
+ */
+void LwpDrawObj::SetPosition(XFFrame* pObj)
+{
+ double fOffsetX = 0.00, fOffsetY = 0.00;
+ double fScaleX = 1.00, fScaleY = 1.00;
+ if (m_pTransData)
+ {
+ fOffsetX = m_pTransData->fOffsetX;
+ fOffsetY = m_pTransData->fOffsetY;
+ fScaleX = m_pTransData->fScaleX;
+ fScaleY = m_pTransData->fScaleY;
+ }
+
+ pObj->SetPosition(static_cast<double>(m_aObjHeader.nLeft)/TWIPS_PER_CM * fScaleX+ fOffsetX,
+ static_cast<double>(m_aObjHeader.nTop)/TWIPS_PER_CM * fScaleY + fOffsetY,
+ static_cast<double>(m_aObjHeader.nRight-m_aObjHeader.nLeft)/TWIPS_PER_CM * fScaleX,
+ static_cast<double>(m_aObjHeader.nBottom-m_aObjHeader.nTop)/TWIPS_PER_CM * fScaleY);
+}
+
+/**
+ * @descr set arrowhead of a xf-drawing object. only opened drawing objects can be assigned arrowheads
+ * @param pOpenedObjStyle the xf-drawing object which will be set arrowhead.
+ * @param nArrowFlag arrowhead flags of the object.
+ */
+void LwpDrawObj::SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth)
+{
+ // no arrowhead
+ if (!nArrowFlag)
+ {
+ return;
+ }
+
+ if (!pOpenedObjStyle)
+ {
+ assert(false);
+ return;
+ }
+
+ // arrowhead flag of an object's start side
+ sal_uInt8 nLeftArrow = nArrowFlag & 0x0F;
+
+ // arrowhead flag of an object's end side
+ sal_uInt8 nRightArrow = (nArrowFlag & 0xF0) >> 4;
+
+ double fWidth_inch = static_cast<double>(nLineWidth)/TWIPS_PER_CM;
+ double fArrowSize_inch = fWidth_inch + 0.08;
+ double fArrowSize = fArrowSize_inch * CM_PER_INCH;
+
+ if (nLeftArrow)
+ {
+ pOpenedObjStyle->SetArrowStart( GetArrowName(nLeftArrow), fArrowSize);
+ }
+ if (nRightArrow)
+ {
+ pOpenedObjStyle->SetArrowEnd( GetArrowName(nRightArrow), fArrowSize);
+ }
+
+}
+
+/**
+ * @descr get arrow style name according to the flag.
+ * @param nArrowStyle style of the arrowhead.
+ * @return nWhichSide style name of the arrowhead.
+ */
+OUString LwpDrawObj::GetArrowName(sal_uInt8 nArrowStyle)
+{
+ // style name of arrowhead
+ OUString aArrowName;
+
+ switch(nArrowStyle)
+ {
+ default:
+ case AH_ARROW_FULLARROW:
+ aArrowName = "Symmetric arrow";
+ break;
+ case AH_ARROW_HALFARROW:
+ aArrowName = "Arrow concave";
+ break;
+ case AH_ARROW_LINEARROW:
+ aArrowName = "arrow100";
+ break;
+ case AH_ARROW_INVFULLARROW:
+ aArrowName = "reverse arrow";
+ break;
+ case AH_ARROW_INVHALFARROW:
+ aArrowName = "reverse concave arrow";
+ break;
+ case AH_ARROW_INVLINEARROW:
+ aArrowName = "reverse line arrow";
+ break;
+ case AH_ARROW_TEE:
+ aArrowName = "Dimension lines";
+ break;
+ case AH_ARROW_SQUARE:
+ aArrowName = "Square";
+ break;
+ case AH_ARROW_CIRCLE:
+ aArrowName = "Circle";
+ break;
+ }
+
+ return aArrowName;
+}
+
+/**
+ * @descr template method of creating drawing object from Lwp-Model to XF-Model
+ * @return pointer of the drawing object of XF-Model.
+ */
+XFFrame* LwpDrawObj::CreateXFDrawObject()
+{
+ // read records
+ Read();
+
+ // register style
+ OUString aStyleName = RegisterStyle();
+
+ // create XF-Objects
+ XFFrame* pXFObj = nullptr;
+ if (m_pTransData
+ && FABS(m_pTransData->fOffsetX - m_pTransData->fLeftMargin) < THRESHOLD
+ && FABS(m_pTransData->fOffsetY - m_pTransData->fTopMargin) < THRESHOLD
+ && FABS(m_pTransData->fScaleX - 1.0) < THRESHOLD
+ && FABS(m_pTransData->fScaleY - 1.0) < THRESHOLD)
+ {
+ pXFObj = CreateStandardDrawObj(aStyleName);
+ }
+ else
+ {
+ pXFObj = CreateDrawObj(aStyleName);
+ }
+
+ // set anchor type
+ if (pXFObj)
+ {
+ pXFObj->SetAnchorType(enumXFAnchorFrame);
+ }
+
+ return pXFObj;
+}
+
+/**
+ * @descr Constructor of class LwpDrawLine
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawLine::LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+: LwpDrawObj(pStream, pTransData)
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawLine
+ */
+void LwpDrawLine::Read()
+{
+ m_pStream->ReadInt16( m_aLineRec.nStartX );
+ m_pStream->ReadInt16( m_aLineRec.nStartY );
+ m_pStream->ReadInt16( m_aLineRec.nEndX );
+ m_pStream->ReadInt16( m_aLineRec.nEndY );
+ m_pStream->ReadUChar( m_aLineRec.nLineWidth );
+ m_pStream->ReadUChar( m_aLineRec.nLineEnd );
+ m_pStream->ReadUChar( m_aLineRec.nLineStyle );
+
+ m_pStream->ReadUChar( m_aLineRec.aPenColor.nR );
+ m_pStream->ReadUChar( m_aLineRec.aPenColor.nG );
+ m_pStream->ReadUChar( m_aLineRec.aPenColor.nB );
+ m_pStream->ReadUChar( m_aLineRec.aPenColor.unused );
+}
+
+OUString LwpDrawLine::RegisterStyle()
+{
+ std::unique_ptr<XFDrawStyle> pStyle( new XFDrawStyle() );
+
+ // set line style
+ SetLineStyle(pStyle.get(), m_aLineRec.nLineWidth, m_aLineRec.nLineStyle, m_aLineRec.aPenColor);
+
+ // set arrow head
+ SetArrowHead(pStyle.get(), m_aLineRec.nLineEnd, m_aLineRec.nLineWidth);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawLine::CreateDrawObj(const OUString& rStyleName )
+{
+ XFDrawPath* pLine = new XFDrawPath();
+ pLine->MoveTo(XFPoint(static_cast<double>(m_aLineRec.nStartX)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aLineRec.nStartY)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ pLine->LineTo(XFPoint(static_cast<double>(m_aLineRec.nEndX)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aLineRec.nEndY)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ SetPosition(pLine);
+
+ pLine->SetStyleName(rStyleName);
+
+ return pLine;
+}
+
+XFFrame* LwpDrawLine::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ XFDrawLine* pLine = new XFDrawLine();
+ pLine->SetStartPoint(static_cast<double>(m_aLineRec.nStartX)/TWIPS_PER_CM,static_cast<double>(m_aLineRec.nStartY)/TWIPS_PER_CM);
+ pLine->SetEndPoint(static_cast<double>(m_aLineRec.nEndX)/TWIPS_PER_CM,static_cast<double>(m_aLineRec.nEndY)/TWIPS_PER_CM);
+
+ pLine->SetStyleName(rStyleName);
+ return pLine;
+}
+
+/**
+ * @descr Constructor of class LwpDrawPolyLine
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawPolyLine::LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+: LwpDrawObj(pStream, pTransData)
+{
+}
+LwpDrawPolyLine::~LwpDrawPolyLine()
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawPolyLine
+ */
+void LwpDrawPolyLine::Read()
+{
+ m_pStream->ReadUChar( m_aPolyLineRec.nLineWidth );
+ m_pStream->ReadUChar( m_aPolyLineRec.nLineEnd );
+ m_pStream->ReadUChar( m_aPolyLineRec.nLineStyle );
+ m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.nR );
+ m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.nG );
+ m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.nB );
+ m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.unused );
+ m_pStream->ReadUInt16( m_aPolyLineRec.nNumPoints );
+
+ if (m_aPolyLineRec.nNumPoints > m_pStream->remainingSize() / 4)
+ throw BadRead();
+
+ m_pVector.reset( new SdwPoint[m_aPolyLineRec.nNumPoints] );
+
+ for (sal_uInt16 nC = 0; nC < m_aPolyLineRec.nNumPoints; nC++)
+ {
+ m_pStream->ReadInt16( m_pVector[nC].x );
+ m_pStream->ReadInt16( m_pVector[nC].y );
+ }
+}
+
+OUString LwpDrawPolyLine::RegisterStyle()
+{
+ std::unique_ptr<XFDrawStyle> pStyle(new XFDrawStyle());
+
+ // set line style
+ SetLineStyle(pStyle.get(), m_aPolyLineRec.nLineWidth, m_aPolyLineRec.nLineStyle,
+ m_aPolyLineRec.aPenColor);
+
+ // set arrow head
+ SetArrowHead(pStyle.get(), m_aPolyLineRec.nLineEnd, m_aPolyLineRec.nLineWidth);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawPolyLine::CreateDrawObj(const OUString& rStyleName )
+{
+ XFDrawPath* pPolyline = new XFDrawPath();
+ pPolyline->MoveTo(XFPoint(static_cast<double>(m_pVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_pVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ for (sal_uInt16 nC = 1; nC < m_aPolyLineRec.nNumPoints; nC++)
+ {
+ pPolyline->LineTo(XFPoint(static_cast<double>(m_pVector[nC].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_pVector[nC].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ }
+ SetPosition(pPolyline);
+
+ pPolyline->SetStyleName(rStyleName);
+
+ return pPolyline;
+}
+
+XFFrame* LwpDrawPolyLine::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ XFDrawPolyline* pPolyline = new XFDrawPolyline();
+ for (sal_uInt16 nC = 0; nC < m_aPolyLineRec.nNumPoints; nC++)
+ {
+ pPolyline->AddPoint(static_cast<double>(m_pVector[nC].x)/TWIPS_PER_CM,
+ static_cast<double>(m_pVector[nC].y)/TWIPS_PER_CM);
+ }
+
+ pPolyline->SetStyleName(rStyleName);
+
+ return pPolyline;
+}
+
+/**
+ * @descr Constructor of class LwpDrawPolygon
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawPolygon::LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+ : LwpDrawObj(pStream, pTransData)
+ , m_nNumPoints(0)
+{
+}
+
+LwpDrawPolygon::~LwpDrawPolygon()
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawPolygon
+ */
+void LwpDrawPolygon::Read()
+{
+ ReadClosedObjStyle();
+ m_pStream->ReadUInt16( m_nNumPoints );
+
+ if (m_nNumPoints > m_pStream->remainingSize() / 4)
+ throw BadRead();
+
+ m_pVector.reset( new SdwPoint[m_nNumPoints] );
+
+ for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++)
+ {
+ m_pStream->ReadInt16( m_pVector[nC].x );
+ m_pStream->ReadInt16( m_pVector[nC].y );
+ }
+}
+
+OUString LwpDrawPolygon::RegisterStyle()
+{
+ std::unique_ptr<XFDrawStyle> pStyle(new XFDrawStyle());
+
+ // set line style
+ SetLineStyle(pStyle.get(), m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
+ m_aClosedObjStyleRec.aPenColor);
+
+ // set fill style
+ SetFillStyle(pStyle.get());
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawPolygon::CreateDrawObj(const OUString& rStyleName)
+{
+ XFDrawPath* pPolygon = new XFDrawPath();
+ pPolygon->MoveTo(XFPoint(static_cast<double>(m_pVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_pVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ for (sal_uInt16 nC = 1; nC < m_nNumPoints; nC++)
+ {
+ pPolygon->LineTo(XFPoint(static_cast<double>(m_pVector[nC].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_pVector[nC].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ }
+ pPolygon->ClosePath();
+ SetPosition(pPolygon);
+ pPolygon->SetStyleName(rStyleName);
+
+ return pPolygon;
+}
+
+XFFrame* LwpDrawPolygon::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ XFDrawPolygon* pPolygon = new XFDrawPolygon();
+ for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++)
+ {
+ pPolygon->AddPoint(static_cast<double>(m_pVector[nC].x)/TWIPS_PER_CM,
+ static_cast<double>(m_pVector[nC].y)/TWIPS_PER_CM);
+ }
+
+ pPolygon->SetStyleName(rStyleName);
+
+ return pPolygon;
+}
+
+/**
+ * @descr Constructor of class LwpDrawRectangle
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawRectangle::LwpDrawRectangle(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+ : LwpDrawObj(pStream, pTransData)
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawRectangle
+ */
+void LwpDrawRectangle::Read()
+{
+ ReadClosedObjStyle();
+
+ sal_uInt8 nPointsCount;
+ if (m_eType == OT_RNDRECT)
+ {
+ nPointsCount = 16;
+ m_pStream->SeekRel(4); // corner points
+ }
+ else
+ {
+ nPointsCount = 4;
+ }
+
+ for (sal_uInt8 nC = 0; nC < nPointsCount; nC++)
+ {
+ m_pStream->ReadInt16( m_aVector[nC].x );
+ m_pStream->ReadInt16( m_aVector[nC].y );
+ }
+}
+
+OUString LwpDrawRectangle::RegisterStyle()
+{
+ std::unique_ptr<XFDrawStyle> pStyle(new XFDrawStyle());
+
+ // set line style
+ SetLineStyle(pStyle.get(), m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
+ m_aClosedObjStyleRec.aPenColor);
+
+ // set fill style
+ SetFillStyle(pStyle.get());
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawRectangle::CreateDrawObj(const OUString& rStyleName)
+{
+ if (m_eType == OT_RNDRECT)
+ {
+ return CreateRoundedRect(rStyleName);
+ }
+ else
+ {
+ XFDrawPath* pRect = new XFDrawPath();
+ pRect->MoveTo(XFPoint(static_cast<double>(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ for (sal_uInt8 nC = 1; nC < 4; nC++)
+ {
+ pRect->LineTo(XFPoint(static_cast<double>(m_aVector[nC].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nC].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ }
+ pRect->LineTo(XFPoint(static_cast<double>(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ pRect->ClosePath();
+ SetPosition(pRect);
+
+ pRect->SetStyleName(rStyleName);
+
+ return pRect;
+ }
+}
+
+XFFrame* LwpDrawRectangle::CreateRoundedRect(const OUString& rStyleName)
+{
+ XFDrawPath* pRoundedRect = new XFDrawPath();
+ pRoundedRect->MoveTo(XFPoint(static_cast<double>(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+
+ sal_uInt8 nPtIndex = 1;
+ for (sal_uInt8 nC = 0; nC < 7; nC++)
+ {
+ if (nC%2 == 0)
+ {
+ XFPoint aCtrl1(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+ XFPoint aCtrl2(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+ XFPoint aDest(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+
+ pRoundedRect->CurveTo(aDest, aCtrl1, aCtrl2);
+ }
+ else
+ {
+ XFPoint aDest(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+
+ pRoundedRect->LineTo(aDest);
+ }
+ }
+
+ pRoundedRect->LineTo(XFPoint(static_cast<double>(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ pRoundedRect->ClosePath();
+ SetPosition(pRoundedRect);
+
+ pRoundedRect->SetStyleName(rStyleName);
+
+ return pRoundedRect;
+}
+
+XFFrame* LwpDrawRectangle::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ if (m_eType == OT_RNDRECT)
+ {
+ return CreateRoundedRect(rStyleName);
+ }
+ else
+ {
+ XFDrawRect* pRect = new XFDrawRect();
+ double fStartX, fStartY, fWidth, fHeight;
+ double fRotAngle = 0.0;
+ SdwRectangle aSdwRect;
+ tools::Rectangle aOriginalRect;
+ Point aPt0, aPt1, aPt2, aPt3;
+
+ aPt0.setX(m_aVector[0].x); aPt0.setY(m_aVector[0].y);
+ aPt1.setX(m_aVector[1].x); aPt1.setY(m_aVector[1].y);
+ aPt2.setX(m_aVector[2].x); aPt2.setY(m_aVector[2].y);
+ aPt3.setX(m_aVector[3].x); aPt3.setY(m_aVector[3].y);
+
+ aSdwRect = SdwRectangle(aPt0, aPt1, aPt2, aPt3);
+ if (aSdwRect.IsRectRotated())
+ {
+ aOriginalRect = aSdwRect.GetOriginalRect();
+ fRotAngle = aSdwRect.GetRotationAngle();
+ }
+ else
+ {
+ aOriginalRect = tools::Rectangle(aPt0, aPt2);
+ }
+
+ fStartX = aOriginalRect.TopLeft().X();
+ fStartY = aOriginalRect.TopLeft().Y();
+ fWidth = aOriginalRect.GetWidth();
+ fHeight = aOriginalRect.GetHeight();
+
+ pRect->SetStartPoint(XFPoint(fStartX/TWIPS_PER_CM + m_pTransData->fOffsetX,
+ fStartY/TWIPS_PER_CM + m_pTransData->fOffsetY));
+ pRect->SetSize(fWidth/TWIPS_PER_CM, fHeight/TWIPS_PER_CM);
+
+ if (aSdwRect.IsRectRotated())
+ {
+ pRect->SetRotate( fRotAngle / PI * 180);// aXFCenter);
+ }
+
+ pRect->SetStyleName(rStyleName);
+
+ return pRect;
+ }
+}
+
+/**
+ * @descr Constructor of class LwpDrawEllipse
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawEllipse::LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+: LwpDrawObj(pStream, pTransData)
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawEllipse
+ */
+void LwpDrawEllipse::Read()
+{
+ ReadClosedObjStyle();
+
+ for (SdwPoint & nC : m_aVector)
+ {
+ m_pStream->ReadInt16( nC.x );
+ m_pStream->ReadInt16( nC.y );
+ }
+}
+
+OUString LwpDrawEllipse::RegisterStyle()
+{
+ std::unique_ptr<XFDrawStyle> pStyle(new XFDrawStyle());
+
+ // set line style
+ SetLineStyle(pStyle.get(), m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
+ m_aClosedObjStyleRec.aPenColor);
+
+ // set fill style
+ SetFillStyle(pStyle.get());
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawEllipse::CreateDrawObj(const OUString& rStyleName )
+{
+ XFDrawPath* pEllipse = new XFDrawPath();
+ pEllipse->MoveTo(XFPoint(static_cast<double>(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ sal_uInt8 nPtIndex = 1;
+ for (sal_uInt8 nC = 0; nC < 4; nC++)
+ {
+ XFPoint aCtrl1(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+ XFPoint aCtrl2(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+ XFPoint aDest(static_cast<double>(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ nPtIndex++;
+
+ pEllipse->CurveTo(aDest, aCtrl1, aCtrl2);
+ }
+ pEllipse->ClosePath();
+ SetPosition(pEllipse);
+
+ pEllipse->SetStyleName(rStyleName);
+
+ return pEllipse;
+}
+
+XFFrame* LwpDrawEllipse::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ return CreateDrawObj(rStyleName);
+}
+
+/**
+ * @descr Constructor of class LwpDrawArc
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawArc::LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData)
+: LwpDrawObj(pStream, pTransData)
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawArc
+ */
+void LwpDrawArc::Read()
+{
+ m_pStream->SeekRel(16);// arcRect, startPt, endPt
+
+ m_pStream->ReadUChar( m_aArcRec.nLineWidth );
+ m_pStream->ReadUChar( m_aArcRec.nLineStyle );
+ m_pStream->ReadUChar( m_aArcRec.aPenColor.nR );
+ m_pStream->ReadUChar( m_aArcRec.aPenColor.nG );
+ m_pStream->ReadUChar( m_aArcRec.aPenColor.nB );
+ m_pStream->ReadUChar( m_aArcRec.aPenColor.unused );
+ m_pStream->ReadUChar( m_aArcRec.nLineEnd );
+
+ for (SdwPoint & nC : m_aVector)
+ {
+ m_pStream->ReadInt16( nC.x );
+ m_pStream->ReadInt16( nC.y );
+ }
+}
+
+OUString LwpDrawArc::RegisterStyle()
+{
+ std::unique_ptr<XFDrawStyle> pStyle(new XFDrawStyle());
+
+ // set line style
+ SetLineStyle(pStyle.get(), m_aArcRec.nLineWidth, m_aArcRec.nLineStyle,
+ m_aArcRec.aPenColor);
+
+ // set arrow head
+ SetArrowHead(pStyle.get(), m_aArcRec.nLineEnd, m_aArcRec.nLineWidth);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawArc::CreateDrawObj(const OUString& rStyleName )
+{
+ XFDrawPath* pArc = new XFDrawPath();
+ pArc->MoveTo(XFPoint(static_cast<double>(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY));
+ XFPoint aDest(static_cast<double>(m_aVector[3].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[3].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ XFPoint aCtl1(static_cast<double>(m_aVector[1].x)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[1].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ XFPoint aCtl2(static_cast<double>(m_aVector[2].x)/TWIPS_PER_CM* m_pTransData->fScaleX,
+ static_cast<double>(m_aVector[2].y)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ pArc->CurveTo(aDest, aCtl1, aCtl2);
+
+ SetPosition(pArc);
+
+ pArc->SetStyleName(rStyleName);
+
+ return pArc;
+}
+
+XFFrame* LwpDrawArc::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ return CreateDrawObj(rStyleName);
+}
+
+/**
+ * @descr Constructor of class LwpDrawTextBox
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawTextBox::LwpDrawTextBox(SvStream* pStream) : LwpDrawObj(pStream)
+{
+}
+
+LwpDrawTextBox::~LwpDrawTextBox()
+{
+ if (m_aTextRec.pTextString)
+ {
+ delete [] m_aTextRec.pTextString;
+ m_aTextRec.pTextString = nullptr;
+ }
+}
+
+void LwpDrawTextBox::SetFontStyle(rtl::Reference<XFFont> const & pFont, SdwTextBoxRecord const * pRec)
+{
+ // color
+ XFColor aXFColor(pRec->aTextColor.nR, pRec->aTextColor.nG,
+ pRec->aTextColor.nB);
+ pFont->SetColor(aXFColor);
+ //size
+ pFont->SetFontSize(pRec->nTextSize/20);
+ // bold
+ pFont->SetBold((pRec->nTextAttrs & TA_BOLD) != 0);
+ // italic
+ pFont->SetItalic((pRec->nTextAttrs & TA_ITALIC) != 0);
+ // strike-through
+ if (pRec->nTextAttrs & TA_STRIKETHRU)
+ {
+ pFont->SetCrossout(enumXFCrossoutSignel);
+ }
+ else
+ {
+ pFont->SetCrossout(enumXFCrossoutNone);
+ }
+ // underline
+ if (pRec->nTextAttrs & TA_UNDERLINE)
+ {
+ pFont->SetUnderline(enumXFUnderlineSingle);
+ }
+ else if (pRec->nTextAttrs & TA_WORDUNDERLINE)
+ {
+ pFont->SetUnderline(enumXFUnderlineSingle, true);
+ }
+ else if (pRec->nTextAttrs & TA_DOUBLEUNDER)
+ {
+ pFont->SetUnderline(enumXFUnderlineDouble);
+ }
+ else
+ {
+ pFont->SetUnderline(enumXFUnderlineNone);
+ }
+ // small-caps
+ if (pRec->nTextAttrs & TA_SMALLCAPS)
+ {
+ pFont->SetTransform(enumXFTransformSmallCaps);
+ }
+}
+
+/**
+ * @descr reading function of class LwpDrawTextBox
+ */
+void LwpDrawTextBox::Read()
+{
+ m_pStream->ReadInt16( m_aVector.x );
+ m_pStream->ReadInt16( m_aVector.y );
+ m_pStream->ReadInt16( m_aTextRec.nTextWidth );
+
+ if (m_aTextRec.nTextWidth == 0)
+ m_aTextRec.nTextWidth = 1;
+
+ m_pStream->ReadInt16( m_aTextRec.nTextHeight );
+ m_pStream->ReadBytes(m_aTextRec.tmpTextFaceName, DRAW_FACESIZE);
+ m_pStream->SeekRel(1);// PitchAndFamily
+
+ m_pStream->ReadInt16( m_aTextRec.nTextSize );
+
+ if (m_aTextRec.nTextSize < 0)
+ m_aTextRec.nTextSize = -m_aTextRec.nTextSize;
+
+ //color
+ m_pStream->ReadUChar( m_aTextRec.aTextColor.nR );
+ m_pStream->ReadUChar( m_aTextRec.aTextColor.nG );
+ m_pStream->ReadUChar( m_aTextRec.aTextColor.nB );
+ m_pStream->ReadUChar( m_aTextRec.aTextColor.unused );
+
+ m_pStream->ReadUInt16( m_aTextRec.nTextAttrs );
+ m_pStream->ReadUInt16( m_aTextRec.nTextCharacterSet );
+ m_pStream->ReadInt16( m_aTextRec.nTextRotation );
+ m_pStream->ReadInt16( m_aTextRec.nTextExtraSpacing );
+
+ // some draw files in version 1.2 have an extra byte following '\0'.
+ // can't rely on that, so read in the whole string into memory.
+
+ // the 71 is the fixed length before text content in textbox record
+ sal_Int16 TextLength = m_aObjHeader.nRecLen - 71;
+ m_aTextRec.pTextString = new sal_uInt8 [TextLength];
+
+ m_pStream->ReadBytes(m_aTextRec.pTextString, TextLength);
+}
+
+OUString LwpDrawTextBox::RegisterStyle()
+{
+ std::unique_ptr<XFParaStyle> pStyle(new XFParaStyle());
+
+ // font style
+ // the pFont need to be deleted myself?
+ rtl::Reference<XFFont> pFont = new XFFont();
+
+ OUString aFontName(reinterpret_cast<char*>(m_aTextRec.tmpTextFaceName),
+ strlen(reinterpret_cast<char*>(m_aTextRec.tmpTextFaceName)), RTL_TEXTENCODING_MS_1252);
+ pFont->SetFontName(aFontName);
+
+ SetFontStyle(pFont, &m_aTextRec);
+
+ pStyle->SetFont(pFont);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawTextBox::CreateDrawObj(const OUString& rStyleName )
+{
+ XFFrame* pTextBox = new XFFrame(true);
+
+ sal_Int16 TextLength = m_aObjHeader.nRecLen - 71;
+ rtl_TextEncoding aEncoding;
+ if (!m_aTextRec.nTextCharacterSet)
+ {
+ aEncoding = osl_getThreadTextEncoding();
+ }
+ else
+ {
+ // temporary code, need to create Encoding from the value of nTextCharacterSet
+ aEncoding = LwpCharSetMgr::GetTextCharEncoding();
+ }
+
+ XFParagraph* pXFPara = new XFParagraph();
+ pXFPara->Add(OUString(reinterpret_cast<char*>(m_aTextRec.pTextString), (TextLength-2), aEncoding));
+ pXFPara->SetStyleName(rStyleName);
+
+ pTextBox->Add(pXFPara);
+ SetPosition(pTextBox);
+
+ std::unique_ptr<XFTextBoxStyle> pBoxStyle(new XFTextBoxStyle());
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ OUString sName = pXFStyleManager->AddStyle(std::move(pBoxStyle)).m_pStyle->GetStyleName();
+ pTextBox->SetStyleName(sName);
+
+ //todo: add the interface for rotating textbox
+// if (m_aTextRec.nTextRotation)
+// {
+// double fAngle = double(3600-m_aTextRec.nTextRotation)/10;
+// pTextBox->SetRotate(fAngle);
+// }
+
+ return pTextBox;
+}
+
+XFFrame* LwpDrawTextBox::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ return CreateDrawObj(rStyleName);
+}
+
+/**
+ * @descr Constructor of class LwpDrawTextBox
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawTextArt::LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData)
+: LwpDrawObj(pStream, pTransData)
+{
+}
+
+LwpDrawTextArt::~LwpDrawTextArt()
+{
+ if (m_aTextArtRec.aPath[0].pPts)
+ {
+ delete [] m_aTextArtRec.aPath[0].pPts;
+ m_aTextArtRec.aPath[0].pPts = nullptr;
+ }
+ if (m_aTextArtRec.aPath[1].pPts)
+ {
+ delete [] m_aTextArtRec.aPath[1].pPts;
+ m_aTextArtRec.aPath[1].pPts = nullptr;
+ }
+ if (m_aTextArtRec.pTextString)
+ {
+ delete [] m_aTextArtRec.pTextString;
+ m_aTextArtRec.pTextString = nullptr;
+ }
+
+}
+
+void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath)
+{
+ sal_Int16 nX, nY;
+ nX = (m_aTextArtRec.aPath[0].pPts[0].x + m_aTextArtRec.aPath[1].pPts[0].x) / 2;
+ nY = (m_aTextArtRec.aPath[0].pPts[0].y + m_aTextArtRec.aPath[1].pPts[0].y) / 2;
+ XFPoint aStart(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
+ pPath->MoveTo(aStart);
+
+ sal_uInt8 nPtIndex = 1;
+ for (sal_uInt16 nC = 1; nC <= m_aTextArtRec.aPath[0].n; nC++)
+ {
+ nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
+ nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
+ XFPoint aCtrl1(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
+
+ nPtIndex++;
+ nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
+ nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
+ XFPoint aCtrl2(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
+
+ nPtIndex++;
+ nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
+ nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
+ XFPoint aDest(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
+ static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
+
+ pPath->CurveTo(aDest, aCtrl1, aCtrl2);
+ }
+}
+
+void LwpDrawTextArt::Read()
+{
+ for (SdwPoint & nC : m_aVector)
+ {
+ m_pStream->ReadInt16( nC.x );
+ m_pStream->ReadInt16( nC.y );
+ }
+
+ ReadClosedObjStyle();
+ m_aTextArtRec.aTextColor = m_aClosedObjStyleRec.aForeColor;
+
+ m_pStream->ReadUChar( m_aTextArtRec.nIndex );
+ m_pStream->ReadInt16( m_aTextArtRec.nRotation );
+
+ sal_uInt16 nPointNumber;
+ sal_Int16 nX, nY;
+ m_pStream->ReadUInt16( nPointNumber );
+
+ size_t nPoints = nPointNumber*3+1;
+ if (nPoints > m_pStream->remainingSize() / 4)
+ throw BadRead();
+
+ m_aTextArtRec.aPath[0].n = nPointNumber;
+ m_aTextArtRec.aPath[0].pPts = new SdwPoint[nPoints];
+ for (size_t nPt = 0; nPt < nPoints; ++nPt)
+ {
+ m_pStream->ReadInt16( nX );
+ m_pStream->ReadInt16( nY );
+ m_aTextArtRec.aPath[0].pPts[nPt].x = nX;
+ m_aTextArtRec.aPath[0].pPts[nPt].y = nY;
+ }
+
+ m_pStream->ReadUInt16( nPointNumber );
+
+ nPoints = nPointNumber*3+1;
+ if (nPoints > m_pStream->remainingSize() / 4)
+ throw BadRead();
+
+ m_aTextArtRec.aPath[1].n = nPointNumber;
+ m_aTextArtRec.aPath[1].pPts = new SdwPoint[nPoints];
+ for (size_t nPt = 0; nPt < nPoints; ++nPt)
+ {
+ m_pStream->ReadInt16( nX );
+ m_pStream->ReadInt16( nY );
+ m_aTextArtRec.aPath[1].pPts[nPt].x = nX;
+ m_aTextArtRec.aPath[1].pPts[nPt].y = nY;
+ }
+
+ m_pStream->SeekRel(1);
+
+ m_pStream->ReadBytes(m_aTextArtRec.tmpTextFaceName, DRAW_FACESIZE);
+ m_pStream->SeekRel(1);// PitchAndFamily
+
+ m_pStream->ReadInt16( m_aTextArtRec.nTextSize );
+
+ if (m_aTextArtRec.nTextSize < 0)
+ m_aTextArtRec.nTextSize = -m_aTextArtRec.nTextSize;
+
+ m_pStream->ReadUInt16( m_aTextArtRec.nTextAttrs );
+ m_pStream->ReadUInt16( m_aTextArtRec.nTextCharacterSet );
+ m_aTextArtRec.nTextRotation = 0;
+ m_pStream->ReadInt16( m_aTextArtRec.nTextExtraSpacing );
+
+ const sal_uInt16 nTextArtFixedLength = 105;
+ m_aTextArtRec.nTextLen = m_aObjHeader.nRecLen - nTextArtFixedLength
+ - (m_aTextArtRec.aPath[0].n*3 + 1)*4
+ - (m_aTextArtRec.aPath[1].n*3 + 1)*4;
+
+
+ if (m_aTextArtRec.nTextLen > m_pStream->remainingSize())
+ throw BadRead();
+
+ m_aTextArtRec.pTextString = new sal_uInt8 [m_aTextArtRec.nTextLen];
+ m_pStream->ReadBytes(m_aTextArtRec.pTextString, m_aTextArtRec.nTextLen);
+ m_aTextArtRec.pTextString[m_aTextArtRec.nTextLen-1] = 0;
+
+}
+
+OUString LwpDrawTextArt::RegisterStyle()
+{
+ std::unique_ptr<XFParaStyle> pStyle(new XFParaStyle());
+
+ // font style
+ // the pFont need to be deleted myself?
+ rtl::Reference<XFFont> pFont = new XFFont();
+
+ OUString aFontName(reinterpret_cast<char*>(m_aTextArtRec.tmpTextFaceName),
+ strlen(reinterpret_cast<char*>(m_aTextArtRec.tmpTextFaceName)), RTL_TEXTENCODING_MS_1252);
+ pFont->SetFontName(aFontName);
+
+ LwpDrawTextBox::SetFontStyle(pFont, &m_aTextArtRec);
+
+ pStyle->SetFont(pFont);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawTextArt::CreateDrawObj(const OUString& rStyleName)
+{
+ XFFrame* pRetObj = nullptr;
+ std::unique_ptr<XFDrawStyle> pStyle(new XFDrawStyle());
+
+ pRetObj = new XFDrawPath();
+ XFDrawPath* pFWPath = static_cast<XFDrawPath*>(pRetObj);
+ CreateFWPath(pFWPath);
+ pStyle->SetFontWorkStyle(enumXFFWSlantY, enumXFFWAdjustAutosize);
+
+ SetPosition(pRetObj);
+
+ rtl_TextEncoding aEncoding;
+ if (!m_aTextArtRec.nTextCharacterSet)
+ {
+ aEncoding = osl_getThreadTextEncoding();
+ }
+ else
+ {
+ // temporary code, need to create Encoding from the value of nTextCharacterSet
+ aEncoding = LwpCharSetMgr::GetTextCharEncoding();
+ }
+
+ XFParagraph* pXFPara = new XFParagraph();
+ pXFPara->Add(OUString(reinterpret_cast<char*>(m_aTextArtRec.pTextString), (m_aTextArtRec.nTextLen-1), aEncoding));
+ pXFPara->SetStyleName(rStyleName);
+ pRetObj->Add(pXFPara);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pRetObj->SetStyleName(pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName());
+
+ return pRetObj;
+}
+
+XFFrame* LwpDrawTextArt::CreateStandardDrawObj(const OUString& rStyleName )
+{
+ return CreateDrawObj(rStyleName);
+}
+
+/**
+ * @descr Constructor of class LwpDrawMetafile
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawMetafile::LwpDrawMetafile(SvStream* pStream) : LwpDrawObj(pStream)
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawMetafile
+ */
+void LwpDrawMetafile::Read()
+{
+ m_pStream->SeekRel(m_aObjHeader.nRecLen -16);
+}
+
+/**
+ * @descr Constructor of class LwpDrawBitmap
+ * @param pStream The memory stream which contains the lwp-sdw draw objects
+ */
+LwpDrawBitmap::LwpDrawBitmap(SvStream* pStream) : LwpDrawObj(pStream)
+{
+}
+
+LwpDrawBitmap::~LwpDrawBitmap()
+{
+}
+
+/**
+ * @descr reading function of class LwpDrawBitmap
+ */
+void LwpDrawBitmap::Read()
+{
+ m_pStream->ReadUInt16( m_aBmpRec.nTranslation );
+ m_pStream->ReadUInt16( m_aBmpRec.nRotation );
+
+ // 20 == length of draw-specific fields.
+ // 14 == length of bmp file header.
+ m_aBmpRec.nFileSize = m_aObjHeader.nRecLen - 20 + 14;
+ m_pImageData.reset( new sal_uInt8 [m_aBmpRec.nFileSize] );
+
+ BmpInfoHeader2 aInfoHeader2;
+ m_pStream->ReadUInt32( aInfoHeader2.nHeaderLen );
+
+ sal_uInt32 N;
+ sal_uInt32 rgbTableSize;
+
+ if (aInfoHeader2.nHeaderLen == sizeof(BmpInfoHeader))
+ {
+ m_pStream->ReadUInt32( aInfoHeader2.nWidth );
+ m_pStream->ReadUInt32( aInfoHeader2.nHeight );
+ m_pStream->ReadUInt16( aInfoHeader2.nPlanes );
+ m_pStream->ReadUInt16( aInfoHeader2.nBitCount );
+
+ N = aInfoHeader2.nPlanes * aInfoHeader2.nBitCount;
+ if (N == 24)
+ {
+ rgbTableSize = 0;
+ }
+ else
+ {
+ rgbTableSize = 3 * (1 << N);
+ }
+ }
+ else
+ {
+ m_pStream->ReadUInt32( aInfoHeader2.nWidth );
+ m_pStream->ReadUInt32( aInfoHeader2.nHeight );
+ m_pStream->ReadUInt16( aInfoHeader2.nPlanes );
+ m_pStream->ReadUInt16( aInfoHeader2.nBitCount );
+ N = aInfoHeader2.nPlanes * aInfoHeader2.nBitCount;
+ if (N == 24)
+ {
+ rgbTableSize = 0;
+ }
+ else
+ {
+ rgbTableSize = 4 * (1 << N);
+ }
+
+ }
+
+ sal_uInt32 nOffBits = 14 + aInfoHeader2.nHeaderLen + rgbTableSize;
+ m_pImageData[0] = 'B';
+ m_pImageData[1] = 'M';
+ m_pImageData[2] = static_cast<sal_uInt8>(m_aBmpRec.nFileSize);
+ m_pImageData[3] = static_cast<sal_uInt8>(m_aBmpRec.nFileSize >> 8);
+ m_pImageData[4] = static_cast<sal_uInt8>(m_aBmpRec.nFileSize >> 16);
+ m_pImageData[5] = static_cast<sal_uInt8>(m_aBmpRec.nFileSize >> 24);
+ m_pImageData[6] = 0;
+ m_pImageData[7] = 0;
+ m_pImageData[8] = 0;
+ m_pImageData[9] = 0;
+ m_pImageData[10] = static_cast<sal_uInt8>(nOffBits);
+ m_pImageData[11] = static_cast<sal_uInt8>(nOffBits >> 8);
+ m_pImageData[12] = static_cast<sal_uInt8>(nOffBits >> 16);
+ m_pImageData[13] = static_cast<sal_uInt8>(nOffBits >> 24);
+
+ sal_uInt32 nDIBRemaining;
+ sal_uInt8* pPicData = m_pImageData.get();
+ if (aInfoHeader2.nHeaderLen== sizeof(BmpInfoHeader))
+ {
+ m_pImageData[14] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen);
+ m_pImageData[15] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen >> 8);
+ m_pImageData[16] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen >> 16);
+ m_pImageData[17] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen >> 24);
+ m_pImageData[18] = static_cast<sal_uInt8>(aInfoHeader2.nWidth);
+ m_pImageData[19] = static_cast<sal_uInt8>(aInfoHeader2.nWidth >> 8);
+ m_pImageData[20] = static_cast<sal_uInt8>(aInfoHeader2.nHeight);
+ m_pImageData[21] = static_cast<sal_uInt8>(aInfoHeader2.nHeight >> 8);
+ m_pImageData[22] = static_cast<sal_uInt8>(aInfoHeader2.nPlanes);
+ m_pImageData[23] = static_cast<sal_uInt8>(aInfoHeader2.nPlanes >> 8);
+ m_pImageData[24] = static_cast<sal_uInt8>(aInfoHeader2.nBitCount);
+ m_pImageData[25] = static_cast<sal_uInt8>(aInfoHeader2.nBitCount >> 8);
+
+ nDIBRemaining = m_aBmpRec.nFileSize - 26;
+ pPicData += 26*sizeof(sal_uInt8);
+ }
+ else
+ {
+ m_pImageData[14] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen);
+ m_pImageData[15] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen >> 8);
+ m_pImageData[16] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen >> 16);
+ m_pImageData[17] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen >> 24);
+ m_pImageData[18] = static_cast<sal_uInt8>(aInfoHeader2.nWidth);
+ m_pImageData[19] = static_cast<sal_uInt8>(aInfoHeader2.nWidth >> 8);
+ m_pImageData[20] = static_cast<sal_uInt8>(aInfoHeader2.nWidth >> 16);
+ m_pImageData[21] = static_cast<sal_uInt8>(aInfoHeader2.nWidth >> 24);
+ m_pImageData[22] = static_cast<sal_uInt8>(aInfoHeader2.nHeight);
+ m_pImageData[23] = static_cast<sal_uInt8>(aInfoHeader2.nHeight >> 8);
+ m_pImageData[24] = static_cast<sal_uInt8>(aInfoHeader2.nHeight >> 16);
+ m_pImageData[25] = static_cast<sal_uInt8>(aInfoHeader2.nHeight >> 24);
+ m_pImageData[26] = static_cast<sal_uInt8>(aInfoHeader2.nPlanes);
+ m_pImageData[27] = static_cast<sal_uInt8>(aInfoHeader2.nPlanes >> 8);
+ m_pImageData[28] = static_cast<sal_uInt8>(aInfoHeader2.nBitCount);
+ m_pImageData[29] = static_cast<sal_uInt8>(aInfoHeader2.nBitCount >> 8);
+
+ nDIBRemaining = m_aBmpRec.nFileSize - 30;
+ pPicData += 30*sizeof(sal_uInt8);
+ }
+
+ m_pStream->ReadBytes(pPicData, nDIBRemaining);
+}
+
+OUString LwpDrawBitmap::RegisterStyle()
+{
+ std::unique_ptr<XFImageStyle> pBmpStyle(new XFImageStyle());
+ pBmpStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelFrame);
+ pBmpStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->AddStyle(std::move(pBmpStyle)).m_pStyle->GetStyleName();
+}
+
+XFFrame* LwpDrawBitmap::CreateDrawObj(const OUString& rStyleName)
+{
+ XFImage* pImage = new XFImage();
+ pImage->SetImageData(m_pImageData.get(), m_aBmpRec.nFileSize);
+ SetPosition(pImage);
+
+ pImage->SetStyleName(rStyleName);
+
+ return pImage;
+}
+
+XFFrame* LwpDrawBitmap::CreateStandardDrawObj(const OUString& rStyleName)
+{
+ return CreateDrawObj(rStyleName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdrawobj.hxx b/lotuswordpro/source/filter/lwpdrawobj.hxx
new file mode 100644
index 000000000..c98daf862
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdrawobj.hxx
@@ -0,0 +1,376 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * The file declares the LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
+ * and so on.
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDRAWOBJ_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDRAWOBJ_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+
+#include "lwpsdwdrawheader.hxx"
+
+#include <memory>
+
+class SvStream;
+class XFFrame;
+class XFDrawStyle;
+
+/**
+ * @brief
+ * Lwp-base-draw object.
+ */
+class LwpDrawObj
+{
+protected:
+ DrawObjectType m_eType;
+ SvStream* m_pStream;
+ SdwDrawObjHeader m_aObjHeader;
+ SdwClosedObjStyleRec m_aClosedObjStyleRec;
+ DrawingOffsetAndScale* m_pTransData;
+
+public:
+ LwpDrawObj(SvStream* pStream, DrawingOffsetAndScale* pTransData = nullptr);
+ virtual ~LwpDrawObj() {}
+
+private:
+ void ReadObjHeaderRecord();
+
+protected:
+ void ReadClosedObjStyle();
+ void SetFillStyle(XFDrawStyle* pStyle);
+ static void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
+ const SdwColor& rColor);
+ void SetPosition(XFFrame* pObj);
+ static void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
+ static OUString GetArrowName(sal_uInt8 nArrowStyle);
+
+protected:
+ /**
+ * @descr read out the record of a draw object.
+ */
+ virtual void Read() = 0;
+
+ /**
+ * @descr register styles of a draw object according to the saved records data.
+ * @return the style name which has been registered.
+ */
+ virtual OUString RegisterStyle() = 0;
+
+ /**
+ * @descr create XF-draw object and assign the style name to it.
+ * @param style name.
+ * @return pointer of the created XF-draw object.
+ */
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) = 0;
+
+ /**
+ * @descr create XF-draw object and assign the style name to it.
+ * @param style name.
+ * @return pointer of the created XF-draw object.
+ */
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) = 0;
+
+public:
+ /**
+ * @descr create a completed XF-draw object(read data, register styles and create XF-draw object)
+ * @return pointer of the created competed XF-draw object.
+ */
+ XFFrame* CreateXFDrawObject();
+
+ /**
+ * @param type of the object.
+ * @descr set the type to the draw object.
+ */
+ void SetObjectType(DrawObjectType eType) { m_eType = eType; }
+};
+
+/**
+ * @brief
+ * Lwp-draw-group object.
+ */
+class LwpDrawGroup : public LwpDrawObj
+{
+public:
+ explicit LwpDrawGroup(SvStream* pStream) : LwpDrawObj(pStream) {}
+
+protected:
+ virtual void Read() override {}
+ virtual OUString RegisterStyle() override
+ {
+ return OUString();
+ }
+ virtual XFFrame* CreateDrawObj(const OUString& /*rStyleName*/) override { return nullptr; }
+ virtual XFFrame* CreateStandardDrawObj(const OUString& /*rStyleName*/) override { return nullptr; }
+};
+
+/**
+ * @brief
+ * Lwp-draw-line object.
+ */
+class LwpDrawLine : public LwpDrawObj
+{
+private:
+ SdwLineRecord m_aLineRec;
+
+public:
+ LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+/**
+ * @brief
+ * Lwp-draw-polyline object.
+ */
+class LwpDrawPolyLine : public LwpDrawObj
+{
+private:
+ SdwPolyLineRecord m_aPolyLineRec;
+ std::unique_ptr<SdwPoint[]> m_pVector;
+
+public:
+ LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
+ virtual ~LwpDrawPolyLine() override;
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+ /**
+ * @brief
+ * Lwp-draw-polygon object.
+ */
+class LwpDrawPolygon : public LwpDrawObj
+{
+private:
+ sal_uInt16 m_nNumPoints;
+ std::unique_ptr<SdwPoint[]> m_pVector;
+
+public:
+ LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
+ virtual ~LwpDrawPolygon() override;
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+/**
+ * @brief
+ * Lwp-draw-rectangle(rounded-corner rectangle) object.
+ */
+class LwpDrawRectangle : public LwpDrawObj
+{
+private:
+ SdwPoint m_aVector[16];
+
+public:
+ LwpDrawRectangle(SvStream* pStream, DrawingOffsetAndScale* pTransData);
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+
+private:
+ XFFrame* CreateRoundedRect(const OUString& rStyleName);
+};
+
+/**
+ * @brief
+ * Lwp-draw-ellipse object.
+ */
+class LwpDrawEllipse : public LwpDrawObj
+{
+private:
+ SdwPoint m_aVector[13];
+
+public:
+ LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData);
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+/**
+ * @brief
+ * Lwp-draw-arc object.
+ */
+class LwpDrawArc : public LwpDrawObj
+{
+private:
+ SdwArcRecord m_aArcRec;
+ SdwPoint m_aVector[4];
+
+public:
+ LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData);
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+/**
+ * @brief
+ * Lwp-draw-textbox object.
+ */
+class XFFont;
+class LwpDrawTextBox : public LwpDrawObj
+{
+private:
+ SdwTextBoxRecord m_aTextRec;
+ SdwPoint m_aVector;
+
+public:
+ explicit LwpDrawTextBox(SvStream* pStream);
+ virtual ~LwpDrawTextBox() override;
+ static void SetFontStyle(rtl::Reference<XFFont> const & pFont, SdwTextBoxRecord const * pRec);
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+/**
+ * @brief
+ * Lwp-draw-curved-text object.
+ */
+class XFDrawPath;
+class LwpDrawTextArt : public LwpDrawObj
+{
+private:
+ SdwTextArt m_aTextArtRec;
+ SdwPoint m_aVector[4];
+
+private:
+ void CreateFWPath(XFDrawPath* pPath);
+
+public:
+ LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData);
+ virtual ~LwpDrawTextArt() override;
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+
+/**
+ * @brief
+ * Lwp-draw-metafile object.
+ */
+class LwpDrawMetafile : public LwpDrawObj
+{
+public:
+ explicit LwpDrawMetafile(SvStream* pStream);
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override
+ {
+ return OUString();
+ }
+ virtual XFFrame* CreateDrawObj(const OUString& /*rStyleName*/) override {return nullptr;}
+ virtual XFFrame* CreateStandardDrawObj(const OUString& /*rStyleName*/) override {return nullptr;}
+};
+
+/**
+ * @brief
+ * Lwp-draw-bitmap object.
+ */
+class LwpDrawBitmap : public LwpDrawObj
+{
+private:
+ SdwBmpRecord m_aBmpRec;
+ std::unique_ptr<sal_uInt8[]> m_pImageData;
+public:
+ explicit LwpDrawBitmap(SvStream* pStream);
+ virtual ~LwpDrawBitmap() override;
+
+protected:
+ virtual void Read() override;
+ virtual OUString RegisterStyle() override;
+ virtual XFFrame* CreateDrawObj(const OUString& rStyleName) override;
+ virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpdropcapmgr.cxx b/lotuswordpro/source/filter/lwpdropcapmgr.cxx
new file mode 100644
index 000000000..f091e7714
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpdropcapmgr.cxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpdropcapmgr.hxx>
+
+LwpDropcapMgr::LwpDropcapMgr()
+{
+ m_pXFPara = nullptr;
+}
+
+LwpDropcapMgr::~LwpDropcapMgr()
+{
+}
+
+void LwpDropcapMgr::SetXFPara(XFParagraph* pXFPara)
+{
+ m_pXFPara = pXFPara;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfilehdr.cxx b/lotuswordpro/source/filter/lwpfilehdr.cxx
new file mode 100644
index 000000000..eea66bf22
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfilehdr.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpfilehdr.hxx>
+#include <lwpdefs.hxx>
+
+//Word Pro 96: 0x0a,
+sal_uInt16 LwpFileHeader::m_nFileRevision = 0;
+
+LwpFileHeader::LwpFileHeader()
+ :m_nAppRevision(0),
+ m_nAppReleaseNo(0), m_nRequiredAppRevision(0), m_nRequiredFileRevision(0),
+ m_cDocumentID(), m_nRootIndexOffset(0)
+{}
+/**
+ * @descr read file header object from svstream
+ */
+void LwpFileHeader::Read(LwpSvStream *pStrm)
+{
+ pStrm->ReadUInt16( m_nAppRevision );
+ pStrm->ReadUInt16( m_nFileRevision );
+ pStrm->ReadUInt16( m_nAppReleaseNo );
+ pStrm->ReadUInt16( m_nRequiredAppRevision );
+ pStrm->ReadUInt16( m_nRequiredFileRevision );
+ m_cDocumentID.Read(pStrm);
+ if (m_nFileRevision < 0x000B)
+ m_nRootIndexOffset = BAD_OFFSET;
+ else
+ {
+ pStrm->ReadUInt32( m_nRootIndexOffset );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx
new file mode 100644
index 000000000..6f95fb651
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfilter.cxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Circle object.
+ ************************************************************************/
+#include "lwpfilter.hxx"
+#include "lwpresource.hxx"
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfsaxstream.hxx>
+#include "lwp9reader.hxx"
+#include <lwpsvstream.hxx>
+#include <xfilter/xffontfactory.hxx>
+#include <xfilter/xfstylemanager.hxx>
+
+#include <osl/file.h>
+#include <osl/file.hxx>
+#include <tools/stream.hxx>
+#include <vcl/svapp.hxx>
+#include <xmloff/attrlist.hxx>
+#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+#include <cppuhelper/supportsservice.hxx>
+
+#include <sfx2/docfile.hxx>
+
+#include <memory>
+
+using namespace ::cppu;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star;
+
+ /**
+ * @descr decompressed small file
+ * @param pCompressed - real file stream
+ * @param pDecompressed - file decompressed, create inside, caller should delete it
+ * @return success - sal_True, fail - sal_False
+ */
+#include "bento.hxx"
+using namespace OpenStormBento;
+#include "explode.hxx"
+static bool Decompress(SvStream *pCompressed, SvStream * & pOutDecompressed)
+{
+ pCompressed->Seek(0);
+ std::unique_ptr<SvMemoryStream> aDecompressed(new SvMemoryStream(4096, 4096));
+ unsigned char buffer[512];
+ pCompressed->ReadBytes(buffer, 16);
+ aDecompressed->WriteBytes(buffer, 16);
+
+ std::unique_ptr<LwpSvStream> aLwpStream(new LwpSvStream(pCompressed));
+ std::unique_ptr<OpenStormBento::LtcBenContainer> pBentoContainer;
+ {
+ sal_uLong ulRet = BenOpenContainer(aLwpStream.get(), &pBentoContainer);
+ if (ulRet != BenErr_OK)
+ return false;
+ }
+
+ std::unique_ptr<LtcUtBenValueStream> aWordProData(pBentoContainer->FindValueStreamWithPropertyName("WordProData"));
+
+ if (!aWordProData)
+ return false;
+
+ // decompressing
+ Decompression decompress(aWordProData.get(), aDecompressed.get());
+ if (0!= decompress.explode())
+ return false;
+
+ sal_uInt32 nPos = aWordProData->GetSize();
+ nPos += 0x10;
+
+ pCompressed->Seek(nPos);
+ while (sal_uInt32 iRead = pCompressed->ReadBytes(buffer, 512))
+ aDecompressed->WriteBytes(buffer, iRead);
+
+ // disable stream growing past its current size
+ aDecompressed->SetResizeOffset(0);
+
+ //transfer ownership of aDecompressed's ptr
+ pOutDecompressed = aDecompressed.release();
+ return true;
+}
+
+ /**
+ * @descr Get LwpSvStream, if small file, both compressed/decompressed stream
+ * Otherwise, only normal stream
+ * @param pStream - real file stream
+ * @param LwpSvStream * , created inside, deleted outside
+ * @param sal_Bool, sal_True -
+ */
+static bool GetLwpSvStream(SvStream *pStream, LwpSvStream * & pLwpSvStream)
+{
+ SvStream * pDecompressed = nullptr;
+
+ pStream->Seek(0x10);
+ sal_uInt32 nTag(0);
+ pStream->ReadUInt32( nTag );
+ if (nTag != 0x3750574c) // "LWP7"
+ {
+ // small file, needs decompression
+ if (!Decompress(pStream, pDecompressed))
+ {
+ pLwpSvStream = nullptr;
+ return true;
+ }
+ pStream->Seek(0);
+ pDecompressed->Seek(0);
+ }
+
+ pLwpSvStream = nullptr;
+ bool bCompressed = false;
+ if (pDecompressed)
+ {
+ LwpSvStream *pOriginalLwpSvStream = new LwpSvStream(pStream);
+ pLwpSvStream = new LwpSvStream(pDecompressed, pOriginalLwpSvStream);
+ bCompressed = true;
+ }
+ else
+ {
+ pLwpSvStream = new LwpSvStream(pStream);
+ }
+ return bCompressed;
+}
+int ReadWordproFile(SvStream &rStream, uno::Reference<css::xml::sax::XDocumentHandler> const & xHandler)
+{
+ int nRet = 0;
+ try
+ {
+ LwpSvStream *pRawLwpSvStream = nullptr;
+ std::unique_ptr<LwpSvStream> aLwpSvStream;
+ std::unique_ptr<LwpSvStream> aCompressedLwpSvStream;
+ std::unique_ptr<SvStream> aDecompressed;
+ if (GetLwpSvStream(&rStream, pRawLwpSvStream) && pRawLwpSvStream)
+ {
+ SvStream *pDecompressed = pRawLwpSvStream->GetStream();
+ if (pDecompressed)
+ {
+ aDecompressed.reset(pDecompressed);
+ aCompressedLwpSvStream.reset(pRawLwpSvStream->GetCompressedStream());
+ }
+ }
+
+ if (!pRawLwpSvStream)
+ {
+ // nothing returned, fail when uncompressing
+ return 1;
+ }
+
+ aLwpSvStream.reset(pRawLwpSvStream);
+
+ std::unique_ptr<IXFStream> pStrm(new XFSaxStream(xHandler));
+ Lwp9Reader reader(aLwpSvStream.get(), pStrm.get());
+ //Reset all static objects,because this function may be called many times.
+ XFGlobalReset();
+ const bool bOk = reader.Read();
+ if (!bOk)
+ nRet = 1;
+ }
+ catch (...)
+ {
+ return 1;
+ }
+ return nRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfilter.hxx b/lotuswordpro/source/filter/lwpfilter.hxx
new file mode 100644
index 000000000..c10ca24b0
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfilter.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFILTER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFILTER_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+class SvStream;
+
+//test code
+int ReadWordproFile(SvStream& rStream,
+ css::uno::Reference<css::xml::sax::XDocumentHandler> const& XDoc);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx
new file mode 100644
index 000000000..f95a1eddb
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -0,0 +1,396 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - footnote layouts
+ */
+
+#include "lwpfnlayout.hxx"
+
+LwpFootnoteLayout::LwpFootnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpTableLayout(objHdr, pStrm)
+{
+}
+
+LwpFootnoteLayout::~LwpFootnoteLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpFootnoteLayout::Read()
+{
+ LwpTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpFootnoteLayout::RegisterStyle()
+{
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpFootnoteLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+LwpFnRowLayout::LwpFnRowLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpRowLayout(objHdr, pStrm)
+{
+}
+
+LwpFnRowLayout::~LwpFnRowLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpFnRowLayout::Read()
+{
+ LwpRowLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register footnote/endnote contents style
+ */
+void LwpFnRowLayout::RegisterStyle()
+{
+ // register cells' style
+ LwpObjectID* pCellID = &GetChildHead();
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+
+ while(pCellLayout)
+ {
+ pCellLayout->SetFoundry(m_pFoundry);
+ pCellLayout->RegisterStyle();
+ pCellID = &pCellLayout->GetNext();
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+ }
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpFnRowLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+LwpFnCellLayout::LwpFnCellLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpCellLayout(objHdr, pStrm)
+{
+}
+
+LwpFnCellLayout::~LwpFnCellLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpFnCellLayout::Read()
+{
+ LwpCellLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register footnote/endnote contents style
+ */
+void LwpFnCellLayout::RegisterStyle()
+{
+ // content object register styles
+ rtl::Reference<LwpObject> pObj = m_Content.obj();
+ if (pObj.is())
+ {
+ pObj->SetFoundry(m_pFoundry);
+ pObj->DoRegisterStyle();
+ }
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpFnCellLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+LwpEndnoteLayout::LwpEndnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpTableLayout(objHdr, pStrm)
+{
+}
+
+LwpEndnoteLayout::~LwpEndnoteLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpEndnoteLayout::Read()
+{
+ LwpTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register footnote/endnote contents style
+ */
+void LwpEndnoteLayout::RegisterStyle()
+{
+ // register style of rows
+ LwpObjectID* pRowID = &GetChildHead();
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ while (pRowLayout)
+ {
+ pRowLayout->SetFoundry(m_pFoundry);
+ pRowLayout->RegisterStyle();
+
+ pRowID = &pRowLayout->GetNext();
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ }
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpEndnoteLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+LwpEnSuperTableLayout::LwpEnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpSuperTableLayout(objHdr, pStrm)
+{
+}
+
+LwpEnSuperTableLayout::~LwpEnSuperTableLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpEnSuperTableLayout::Read()
+{
+ LwpSuperTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpEnSuperTableLayout::RegisterStyle()
+{
+ // if this layout is style of real table entry
+ LwpVirtualLayout* pTableLayout = GetMainTableLayout();
+ if (pTableLayout != nullptr)
+ {
+ pTableLayout->SetFoundry(m_pFoundry);
+ pTableLayout->DoRegisterStyle();
+ }
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+/**
+ * @short Get child endnote layout
+ * @return pointer to endnote layout
+ */
+LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout()
+{
+ LwpObjectID *pID = &GetChildTail();
+
+ LwpVirtualLayout *pPrevLayout = nullptr;
+ while(!pID->IsNull())
+ {
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get());
+ if (!pLayout || pLayout == pPrevLayout)
+ {
+ break;
+ }
+ if (pLayout->GetLayoutType() == LWP_ENDNOTE_LAYOUT)
+ {
+ return pLayout;
+ }
+ pID = &pLayout->GetPrevious();
+ pPrevLayout = pLayout;
+ }
+
+ return nullptr;
+}
+
+LwpFnSuperTableLayout::LwpFnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpEnSuperTableLayout(objHdr, pStrm)
+{
+}
+
+LwpFnSuperTableLayout::~LwpFnSuperTableLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpFnSuperTableLayout::Read()
+{
+ LwpEnSuperTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpFnSuperTableLayout::RegisterStyle()
+{
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpFnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+/**
+ * @short Get child footnote layout
+ * @return pointer to footnote layout
+ */
+LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
+{
+ LwpObjectID *pID = &GetChildTail();
+
+ while(pID && !pID->IsNull())
+ {
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
+ if(!pLayout)
+ {
+ break;
+ }
+ if (pLayout->GetLayoutType() == LWP_FOOTNOTE_LAYOUT)
+ {
+ return pLayout;
+ }
+ pID = &pLayout->GetPrevious();
+ }
+
+ return nullptr;
+}
+
+LwpContFromLayout::LwpContFromLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpPlacableLayout(objHdr, pStrm)
+{
+}
+
+LwpContFromLayout::~LwpContFromLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpContFromLayout::Read()
+{
+ LwpPlacableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpContFromLayout::RegisterStyle()
+{
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpContFromLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+LwpContOnLayout::LwpContOnLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpPlacableLayout(objHdr, pStrm)
+{
+}
+
+LwpContOnLayout::~LwpContOnLayout()
+{}
+
+/**
+ * @descr Read object info
+ */
+void LwpContOnLayout::Read()
+{
+ LwpPlacableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpContOnLayout::RegisterStyle()
+{
+}
+
+/**
+ * @descr Do nothing
+ */
+void LwpContOnLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfnlayout.hxx b/lotuswordpro/source/filter/lwpfnlayout.hxx
new file mode 100644
index 000000000..0cdd9d1cc
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfnlayout.hxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - footnote layouts
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFNLAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFNLAYOUT_HXX
+
+#include "lwptablelayout.hxx"
+#include "lwprowlayout.hxx"
+
+/**
+ * @brief VO_FOOTNOTELAYOUT object
+ *
+*/
+class LwpFootnoteLayout : public LwpTableLayout
+{
+public:
+ LwpFootnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFootnoteLayout() override;
+ void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer * pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_FOOTNOTE_LAYOUT;}
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_FNROWLAYOUT object
+ *
+*/
+class LwpFnRowLayout : public LwpRowLayout
+{
+public:
+ LwpFnRowLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFnRowLayout() override;
+ void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer * pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_FOOTNOTE_ROW_LAYOUT;}
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_FNCELLLAYOUT object
+ *
+*/
+class LwpFnCellLayout : public LwpCellLayout
+{
+public:
+ LwpFnCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFnCellLayout() override;
+ void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer * pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_FOOTNOTE_CELL_LAYOUT;}
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_ENDNOTELAYOUT object
+ *
+*/
+class LwpEndnoteLayout : public LwpTableLayout
+{
+public:
+ LwpEndnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpEndnoteLayout() override;
+ void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer * pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_ENDNOTE_LAYOUT;}
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_ENSUPERTABLELAYOUT object
+ *
+*/
+class LwpEnSuperTableLayout : public LwpSuperTableLayout
+{
+public:
+ LwpEnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpEnSuperTableLayout() override;
+ void RegisterStyle() override;
+ void XFConvert(XFContentContainer* pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_ENDNOTE_SUPERTABLE_LAYOUT;}
+ virtual LwpVirtualLayout* GetMainTableLayout();
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_FNSUPERTABLELAYOUT object
+ *
+*/
+class LwpFnSuperTableLayout : public LwpEnSuperTableLayout
+{
+public:
+ LwpFnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFnSuperTableLayout() override;
+ void RegisterStyle() override;
+ void XFConvert(XFContentContainer* pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_FOOTNOTE_SUPERTABLE_LAYOUT;}
+ virtual LwpVirtualLayout* GetMainTableLayout() override;
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_CONTFROMLAYOUT object
+ *
+*/
+class LwpContFromLayout : public LwpPlacableLayout
+{
+public:
+ LwpContFromLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpContFromLayout() override;
+ void RegisterStyle() override;
+ void XFConvert(XFContentContainer* pCont) override;
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_CONTONLAYOUT object
+ *
+*/
+class LwpContOnLayout : public LwpPlacableLayout
+{
+public:
+ LwpContOnLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpContOnLayout() override;
+ void RegisterStyle() override;
+ void XFConvert(XFContentContainer* pCont) override;
+protected:
+ void Read() override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx
new file mode 100644
index 000000000..f8d807757
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfont.cxx
@@ -0,0 +1,511 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpglobalmgr.hxx>
+#include <lwpfont.hxx>
+#include <lwpbasetype.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xffontfactory.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfdefs.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <sal/log.hxx>
+
+void LwpFontAttrEntry::Read(LwpObjectStream *pStrm)
+{
+ m_nAttrBits = pStrm->QuickReaduInt16();
+ m_nAttrOverrideBits = pStrm->QuickReaduInt16();
+ m_nAttrApplyBits = pStrm->QuickReaduInt16();
+ m_nAttrOverrideBits2 = pStrm->QuickReaduInt8();
+ m_nAttrApplyBits2 = pStrm->QuickReaduInt8();
+ m_nCase = pStrm->QuickReaduInt8();
+ m_nUnder = pStrm->QuickReaduInt8();
+ pStrm->SkipExtra();
+}
+
+void LwpFontAttrEntry::Override( rtl::Reference<XFFont> const & pFont )
+{
+ if (IsBoldOverridden())
+ pFont->SetBold(Is(BOLD));
+
+ if (IsItalicOverridden())
+ pFont->SetItalic(Is(ITALIC));
+
+ if (IsStrikeThruOverridden())
+ {
+ if(Is(STRIKETHRU))
+ {
+ pFont->SetCrossout(enumXFCrossoutSignel);
+ }
+ else
+ {
+ pFont->SetCrossout(enumXFCrossoutNone);
+ }
+ }
+
+ if (IsSuperOverridden())
+ {
+ if(Is(SUPERSCRIPT))
+ pFont->SetPosition();
+ }
+
+ if (IsSubOverridden())
+ {
+ if(Is(SUBSCRIPT))
+ pFont->SetPosition(false);
+ }
+
+ if (IsUnderlineOverridden())
+ {
+ switch(m_nUnder)
+ {
+ case UNDER_SINGLE:
+ pFont->SetUnderline(enumXFUnderlineSingle);
+ break;
+ case UNDER_DOUBLE:
+ pFont->SetUnderline(enumXFUnderlineDouble);
+ break;
+ case UNDER_WORD_SINGLE:
+ pFont->SetUnderline(enumXFUnderlineSingle, true);
+ break;
+ case UNDER_WORD_DOUBLE:
+ pFont->SetUnderline(enumXFUnderlineSingle, true);
+ break;
+ case UNDER_DONTCARE: //fall through
+ case UNDER_OFF: //fall through
+ case UNDER_STYLE: //fall through
+ default:
+ break;
+ //do nothing;
+ }
+ }
+
+ if (IsCaseOverridden())
+ {
+ switch(m_nCase)
+ {
+ case CASE_UPPER:
+ pFont->SetTransform(enumXFTransformUpper);
+ break;
+ case CASE_LOWER:
+ pFont->SetTransform(enumXFTransformLower);
+ break;
+ case CASE_NORMAL:
+ pFont->SetTransform(enumXFTransformNone);
+ break;
+ case CASE_INITCAPS:
+ pFont->SetTransform(enumXFTransformCapitalize);
+ break;
+ case CASE_STYLE: //fall through
+ case CASE_DONTCARE: //fall through
+ default:
+ //do nothing
+ ;
+ }
+ }
+
+ //Please note that, put the SmallCaps setting after the case setting,
+ //for SmallCaps has higher priority than LowerCase but low
+ if (IsSmallCapsOverridden())
+ {
+ if( pFont->GetTransform()!=enumXFTransformUpper ) //SmallCaps should not override upper case
+ {
+ if(Is(SMALLCAPS))
+ pFont->SetTransform(enumXFTransformSmallCaps);
+ }
+ }
+
+ // TODO: tightness
+ //if (IsTightnessOverridden())
+ // pFont->SetTightness(cTightness);*/
+}
+
+bool LwpFontAttrEntry::Is(sal_uInt16 Attr)
+{
+ return (0 != (m_nAttrBits & Attr));
+}
+
+bool LwpFontAttrEntry::IsBoldOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits & BOLD));
+}
+
+bool LwpFontAttrEntry::IsItalicOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits & ITALIC));
+}
+bool LwpFontAttrEntry::IsStrikeThruOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits & STRIKETHRU));
+}
+bool LwpFontAttrEntry::IsSmallCapsOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits & SMALLCAPS));
+}
+bool LwpFontAttrEntry::IsSuperOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits & SUPERSCRIPT));
+
+}
+bool LwpFontAttrEntry::IsSubOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits & SUBSCRIPT));
+
+}
+
+bool LwpFontAttrEntry::IsUnderlineOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits2 & UNDER));
+}
+bool LwpFontAttrEntry::IsCaseOverridden() const
+{
+ return (0 != (m_nAttrOverrideBits2 & CASE));
+}
+
+void LwpFontTableEntry::Read(LwpObjectStream *pStrm)
+{
+ m_WindowsFaceName.Read(pStrm);
+
+ // use the m_WindowsFaceName to set the m_FaceName temporarily
+ m_FaceName = m_WindowsFaceName;
+
+ //Skip the panoseNumber
+ //m_PanoseNumber.Read(pStrm);
+ LwpPanoseNumber thePanoseToSkip;
+ thePanoseToSkip.Read(pStrm);
+
+ pStrm->SkipExtra();
+
+ RegisterFontDecl();
+}
+
+OUString const & LwpFontTableEntry::GetFaceName() const
+{
+ return m_WindowsFaceName.str();
+}
+
+void LwpFontTableEntry::RegisterFontDecl()
+{
+ if(m_FaceName.str().isEmpty()) return;
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFFontDecl aFontDecl1( m_FaceName.str(), m_FaceName.str() );
+ pXFStyleManager->AddFontDecl(aFontDecl1);
+}
+
+LwpFontTable::LwpFontTable()
+ : m_nCount(0)
+{}
+
+void LwpFontTable::Read(LwpObjectStream *pStrm)
+{
+ m_pFontEntries = nullptr;
+ m_nCount = pStrm->QuickReaduInt16();
+ if(m_nCount>0)
+ {
+ m_pFontEntries.reset( new LwpFontTableEntry[m_nCount] );
+ for(sal_uInt16 i=0; i<m_nCount; i++)
+ {
+ m_pFontEntries[i].Read(pStrm);
+ }
+ }
+ pStrm->SkipExtra();
+}
+
+OUString LwpFontTable::GetFaceName(sal_uInt16 index) //index: start from 1
+{
+ SAL_WARN_IF(index > m_nCount || index <= 0, "lwp", "bad font index");
+ return (index <= m_nCount && index > 0) ? m_pFontEntries[index-1].GetFaceName() : OUString();
+}
+
+LwpFontTable::~LwpFontTable()
+{
+}
+
+void LwpFontNameEntry::Read(LwpObjectStream *pStrm)
+{
+ //Read CFontDescriptionOverrideBase
+ m_nOverrideBits = pStrm->QuickReaduInt8();
+ m_nApplyBits = pStrm->QuickReaduInt8();
+ m_nPointSize = pStrm->QuickReaduInt32();
+ m_nOverstrike = pStrm->QuickReaduInt16();
+ m_nTightness = pStrm->QuickReaduInt16();
+ m_Color.Read(pStrm);
+ m_BackColor.Read(pStrm);
+ pStrm->SkipExtra();
+
+ //Read data of LwpFontNameEntry
+ m_nFaceName = pStrm->QuickReaduInt16();
+ m_nAltFaceName = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+
+void LwpFontNameEntry::Override(rtl::Reference<XFFont> const & pFont)
+{
+ if (IsPointSizeOverridden())
+ pFont->SetFontSize(static_cast<sal_uInt8>(m_nPointSize/65536L));
+
+ if (IsColorOverridden() && m_Color.IsValidColor())
+ {
+ XFColor aColor(m_Color.To24Color());
+ pFont->SetColor(aColor);
+ }
+
+ if (IsBackgroundColorOverridden() )
+ {
+ if (m_BackColor.IsValidColor())
+ {
+ XFColor aColor(m_BackColor.To24Color());
+ pFont->SetBackColor( aColor );
+ }
+ else if (m_BackColor.IsTransparent())
+ {
+ pFont->SetBackColorTransparent();
+ }
+ }
+
+ // TODO: tightness
+ //if (IsTightnessOverridden())
+ // pFont->SetTightness(cTightness);
+}
+
+bool LwpFontNameEntry::IsFaceNameOverridden() const
+{
+ return (0 != (m_nOverrideBits & FACENAME));
+}
+
+bool LwpFontNameEntry::IsAltFaceNameOverridden() const
+{
+ return (0 != (m_nOverrideBits & ALTFACENAME));
+}
+
+bool LwpFontNameEntry::IsPointSizeOverridden() const
+{
+ return (0 != (m_nOverrideBits & POINTSIZE));
+}
+
+bool LwpFontNameEntry::IsColorOverridden() const
+{
+ return (0 != (m_nOverrideBits & COLOR));
+}
+
+bool LwpFontNameEntry::IsBackgroundColorOverridden() const
+{
+ return (0 != (m_nOverrideBits & BKCOLOR));
+}
+
+//TODO
+//sal_Bool LwpFontNameEntry::IsTightnessOverridden()
+//{
+// return (0 != (m_nOverrideBits & TIGHTNESS));
+//}
+
+//sal_Bool LwpFontNameEntry::IsAnythingOverridden()
+//{
+// return (0 != (m_nOverrideBits & ALL_BITS));
+//}
+
+LwpFontNameManager::LwpFontNameManager()
+ : m_nCount(0)
+{}
+
+LwpFontNameManager::~LwpFontNameManager()
+{
+}
+
+void LwpFontNameManager::Read(LwpObjectStream *pStrm)
+{
+ m_nCount = pStrm->QuickReaduInt16();
+ if(m_nCount>0)
+ {
+ m_pFontNames.reset( new LwpFontNameEntry[m_nCount] );
+ for(sal_uInt16 i=0; i<m_nCount; i++)
+ {
+ m_pFontNames[i].Read(pStrm);
+ }
+ }
+ m_FontTbl.Read(pStrm);
+ pStrm->SkipExtra();
+}
+
+void LwpFontNameManager::Override(sal_uInt16 index, rtl::Reference<XFFont> const & pFont)
+ //index: start from 1
+{
+ if (index > m_nCount || index < 1)
+ return ;
+
+ m_pFontNames[index-1].Override(pFont);
+ if(m_pFontNames[index-1].IsFaceNameOverridden())
+ pFont->SetFontName(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetFaceID()));
+ if(m_pFontNames[index-1].IsAltFaceNameOverridden())
+ pFont->SetFontNameAsia(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetAltFaceID()));
+}
+
+OUString LwpFontNameManager::GetNameByIndex(sal_uInt16 index)
+ //index: start from 1
+{
+ if (index > m_nCount || index < 1)
+ return OUString();
+
+ sal_uInt16 nameindex = m_pFontNames[index-1].GetFaceID();
+ return m_FontTbl.GetFaceName(nameindex);
+}
+
+void LwpFontAttrManager::Read(LwpObjectStream *pStrm)
+{
+ m_nCount = pStrm->QuickReaduInt16();
+ m_pFontAttrs.reset( new LwpFontAttrEntry[m_nCount] );
+
+ for(sal_uInt16 i=0; i<m_nCount; i++)
+ {
+ m_pFontAttrs[i].Read(pStrm);
+ }
+ pStrm->SkipExtra();
+}
+
+void LwpFontAttrManager::Override(sal_uInt16 index, rtl::Reference<XFFont> const & pFont)
+ //index: start from 1
+{
+ if (index > m_nCount || index < 1)
+ return ;
+
+ m_pFontAttrs[index-1].Override(pFont);
+}
+
+LwpFontAttrManager::~LwpFontAttrManager()
+{
+}
+
+void LwpFontManager::Read(LwpObjectStream *pStrm)
+{
+ m_FNMgr.Read(pStrm);
+ m_AttrMgr.Read(pStrm);
+ pStrm->SkipExtra();
+
+}
+
+/*
+VO_PARASTYLE call this method to add its style to XFStyleManager based on the fontID
+1. Construct the text style based on the fontID
+2. Add the style to XFStyleManager, and return the <office:styles> style name
+3. Add it to LwpParaStyleMap.
+Note: A temporary method for only font support phase. The next AddStyle should be used later.
+// To be replaced by LwpStyleManager::AddStyle() and the following CreateFont()
+*/
+/*void LwpFontManager::AddStyle(LwpObjectID styleObjID, sal_uInt32 fontID, OUString styleName)
+{
+ XFTextStyle* pStyle = new XFTextStyle(); //to be deleted by XFStyleManager
+ AddStyle(styleObjID, fontID, styleName, pStyle);
+}*/
+
+/*
+VO_PARASTYLE/VO_CHARACTERSTYLE call this method to add its style to XFStyleManager based on the fontID
+1. Construct the text style based on the fontID
+2. Add the style to XFStyleManager, and return the <office:styles> style name
+3. Add it to LwpParaStyleMap.
+Prerequisite: pStyle has been created and the paragraph properties has been set to it.
+//To be replaced by LwpStyleManager::AddStyle() and the following CreateFont()
+*/
+/*void LwpFontManager::AddStyle(LwpObjectID styleObjID, sal_uInt32 fontID, OUString styleName, XFTextStyle* pStyle)
+{
+ assert(pStyle);
+ XFFont* pFont = CreateFont(fontID);
+ pStyle->SetFont(pFont);
+ pStyle->SetStyleName(styleName);
+ XFStyleManager::AddStyle(pStyle);
+ m_StyleList.emplace( styleObjID, styleName));
+}*/
+
+/*
+Create XFFont based on the fotID
+*/
+rtl::Reference<XFFont> LwpFontManager::CreateFont(sal_uInt32 fontID)
+{
+ rtl::Reference<XFFont> pFont = new XFFont();
+ m_FNMgr.Override(GetFontNameIndex(fontID), pFont);
+ m_AttrMgr.Override(GetFontAttrIndex(fontID), pFont);
+ return pFont;
+}
+
+/*
+Called XFFont based on the override result of two font ids.
+Refer to CFontManager::OverrideID
+*/
+//OUString LwpFontManager::GetOverrideStyle(sal_uInt32 fontID, sal_uInt32 overID)
+rtl::Reference<XFFont> LwpFontManager::CreateOverrideFont(sal_uInt32 fontID, sal_uInt32 overID)
+{
+ rtl::Reference<XFFont> pFont = new XFFont(); //To be deleted by XFFontFactory
+ if(fontID)
+ {
+ Override(fontID, pFont);
+ }
+ if(overID)
+ {
+ Override(overID, pFont);
+ }
+ return pFont;
+}
+
+void LwpFontManager::Override(sal_uInt32 fontID, rtl::Reference<XFFont> const & pFont)
+{
+ m_FNMgr.Override(GetFontNameIndex(fontID), pFont);
+ m_AttrMgr.Override(GetFontAttrIndex(fontID), pFont);
+}
+
+OUString LwpFontManager::GetNameByID(sal_uInt32 fontID)
+{
+ return m_FNMgr.GetNameByIndex(GetFontNameIndex(fontID));//use font id for bullet?
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
new file mode 100644
index 000000000..175672263
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -0,0 +1,554 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <memory>
+#include "lwpfootnote.hxx"
+#include "lwpstory.hxx"
+#include <xfilter/xffootnote.hxx>
+#include <xfilter/xfendnote.hxx>
+#include <xfilter/xffootnoteconfig.hxx>
+#include <xfilter/xfendnoteconfig.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xftextspan.hxx>
+#include "lwppara.hxx"
+#include "lwpdoc.hxx"
+#include "lwpfnlayout.hxx"
+#include <lwpglobalmgr.hxx>
+
+LwpFribFootnote::LwpFribFootnote(LwpPara* pPara ):LwpFrib(pPara)
+{
+}
+
+/**
+ * @descr read footnote frib information
+ */
+void LwpFribFootnote::Read(LwpObjectStream * pObjStrm, sal_uInt16 /*len*/)
+{
+ m_Footnote.ReadIndexed(pObjStrm);
+}
+
+/**
+ * @descr Register footnote style by calling LwpFootnote::RegisterStyle()
+ */
+void LwpFribFootnote::RegisterNewStyle()
+{
+ LwpFootnote* pFootnote = GetFootnote();
+ if(pFootnote)
+ {
+ //register footnote number font style
+ LwpFrib::RegisterStyle(m_pPara->GetFoundry());
+ //register footnote content style
+ pFootnote->SetFoundry(m_pPara->GetFoundry());
+ pFootnote->RegisterStyle();
+ }
+}
+
+/**
+ * @descr Parse footnote by calling LwpFootnote::XFConvert()
+ */
+void LwpFribFootnote::XFConvert(XFContentContainer* pCont)
+{
+ LwpFootnote* pFootnote = GetFootnote();
+ if(!pFootnote)
+ return;
+
+ rtl::Reference<XFContentContainer> xContent;
+ if(pFootnote->GetType() == FN_FOOTNOTE)
+ {
+ xContent.set(new XFFootNote);
+ }
+ else
+ {
+ xContent.set(new XFEndNote);
+ }
+ pFootnote->XFConvert(xContent.get());
+ if (m_ModFlag)
+ {
+ //set footnote number font style
+ rtl::Reference<XFTextSpan> xSpan(new XFTextSpan);
+ xSpan->SetStyleName(GetStyleName());
+ //add the xffootnote into the content container
+ xSpan->Add(xContent.get());
+ pCont->Add(xSpan.get());
+ }
+ else
+ {
+ pCont->Add(xContent.get());
+ }
+}
+
+/**
+ * @descr Get foonote object
+ */
+LwpFootnote* LwpFribFootnote::GetFootnote()
+{
+ return dynamic_cast<LwpFootnote*>(m_Footnote.obj().get());
+}
+
+LwpFootnote::LwpFootnote(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpOrderedObject(objHdr, pStrm)
+ , m_nType(0)
+ , m_nRow(0)
+{
+}
+
+LwpFootnote::~LwpFootnote()
+{
+
+}
+
+/**
+ * @descr Read foonote object
+ */
+void LwpFootnote::Read()
+{
+ LwpOrderedObject::Read();
+ m_nType = m_pObjStrm->QuickReaduInt16();
+ m_nRow = m_pObjStrm->QuickReaduInt16();
+ m_Content.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register footnote style
+ */
+void LwpFootnote::RegisterStyle()
+{
+ //Only register footnote contents style,
+ //Endnote contents style registers in LwpEnSuperTableLayout::RegisterStyle
+ if(m_nType == FN_FOOTNOTE)
+ {
+ LwpContent* pContent = FindFootnoteContent();
+ if(pContent)
+ {
+ pContent->SetFoundry(m_pFoundry);
+ pContent->DoRegisterStyle();
+ }
+ }
+}
+
+/**
+ * @descr Parse footnote
+ */
+void LwpFootnote::XFConvert(XFContentContainer * pCont)
+{
+ LwpContent* pContent = FindFootnoteContent();
+ if(pContent)
+ {
+ pContent->DoXFConvert(pCont);
+ }
+}
+
+/**
+ * @descr Get endnote cell layout which contains current endnote content
+ */
+LwpCellLayout* LwpFootnote::GetCellLayout()
+{
+ LwpEnSuperTableLayout* pEnSuperLayout = FindFootnoteTableLayout();
+ if(pEnSuperLayout)
+ {
+ LwpTableLayout* pTableLayout = dynamic_cast<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
+ if(pTableLayout)
+ {
+ LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow);
+ if(pRowLayout)
+ {
+ return dynamic_cast<LwpCellLayout*>(pRowLayout->GetChildHead().obj().get());
+ }
+ }
+ }
+ return nullptr;
+}
+
+/**
+ * @descr Get division which footnote table contains current footnote content, copy from lwp source code
+ */
+LwpDocument* LwpFootnote::GetFootnoteTableDivision()
+{
+ if(!m_pFoundry)
+ return nullptr;
+
+ LwpDocument* pPrev =nullptr;
+ LwpDocument* pDivision = nullptr;
+ LwpDocument* pFootnoteDivision =nullptr;
+
+ // Make sure the footnote does belong to some division
+ // The division might not have a DivisionInfo if it's being Destruct()ed
+ pPrev = m_pFoundry->GetDocument();
+ pFootnoteDivision = pPrev;
+ if (!pPrev || pPrev->GetDivInfoID().IsNull())
+ return nullptr;
+
+ switch (m_nType)
+ {
+ case FN_FOOTNOTE:
+ {
+ // Footnotes always use the source division
+ return pFootnoteDivision;
+ }
+ case FN_DIVISION:
+ {
+ // Start with the footnote's division
+ pDivision = pPrev;
+ break;
+ }
+ case FN_DIVISION_SEPARATE:
+ {
+ // It had better be the next division
+ pDivision = pPrev->GetNextDivision();
+ break;
+ }
+ case FN_DIVISIONGROUP:
+ case FN_DIVISIONGROUP_SEPARATE:
+ {
+ pDivision = pPrev->GetLastInGroupWithContents();
+ break;
+ }
+ case FN_DOCUMENT:
+ case FN_DOCUMENT_SEPARATE:
+ {
+ pDivision = pFootnoteDivision->GetRootDocument();
+ if (pDivision)
+ pDivision = pDivision->GetLastDivisionWithContents();
+ break;
+ }
+
+ }
+
+ // Make sure we're using the proper endnote division, if it's separate
+ if (m_nType & FN_MASK_SEPARATE)
+ pDivision = GetEndnoteDivision(pDivision);
+ // Don't use a division that's specifically for endnotes
+ else
+ {
+ while (pDivision)
+ {
+ if (pDivision->GetEndnoteType() == FN_DONTCARE)
+ break;
+ if (m_nType == FN_DIVISIONGROUP)
+ pDivision = pDivision->GetPreviousInGroup();
+ else
+ pDivision = pDivision->GetPreviousDivisionWithContents();
+ }
+ }
+ if (pDivision)
+ return pDivision;
+ return nullptr;
+}
+
+/**
+ * @descr Get division which endnote table contains current endnote content, copy from lwp source code
+ */
+LwpDocument* LwpFootnote::GetEndnoteDivision(LwpDocument* pPossible)
+{
+ LwpDocument* pDivision = pPossible;
+ sal_uInt16 nDivType;
+
+ // In case we have multiple endnote divisions, walk backwards until
+ // we find one.
+ while (pDivision)
+ {
+ // Do we already have the right division?
+ nDivType = pDivision->GetEndnoteType();
+ if (nDivType == m_nType)
+ return pDivision;
+ // When we hit the first non-endnote division, stop looking.
+ // -- SDC 10/8/96
+ if (nDivType == FN_DONTCARE)
+ break;
+ pDivision = pDivision->GetPreviousDivision();
+ }
+ return nullptr;
+}
+
+/**
+ * @descr Get footnote table class name
+ */
+OUString LwpFootnote::GetTableClass() const
+{
+ OUString strClassName;
+ switch (GetType() & FN_MASK_BASE)
+ {
+ case FN_BASE_FOOTNOTE:
+ {
+ strClassName = STR_DivisionFootnote;
+ break;
+ }
+ case FN_BASE_DOCUMENT:
+ {
+ strClassName = STR_DocumentEndnote;
+ break;
+ }
+ case FN_BASE_DIVISION:
+ {
+ strClassName = STR_DivisionEndnote;
+ break;
+ }
+ case FN_BASE_DIVISIONGROUP:
+ {
+ strClassName = STR_DivisionGroupEndnote;
+ break;
+ }
+ }
+ return strClassName;
+}
+
+/**
+ * @descr Find footnote tablelayout, copy from lwp source code
+ */
+LwpEnSuperTableLayout* LwpFootnote::FindFootnoteTableLayout()
+{
+ LwpDocument* pDivision = GetFootnoteTableDivision();
+ if(!pDivision)
+ return nullptr;
+
+ LwpFoundry* pFoundry = pDivision->GetFoundry();
+ OUString strClassName = GetTableClass();
+ if(strClassName.isEmpty() )
+ return nullptr;
+
+ LwpContent* pContent = nullptr;
+
+ while ((pContent = pFoundry->EnumContents(pContent)) != nullptr)
+ if (pContent->IsTable() && (strClassName == pContent->GetClassName()) &&
+ pContent->IsActive() && pContent->GetLayout(nullptr).is())
+ {
+ // Found it!
+ return static_cast<LwpEnSuperTableLayout *>(
+ static_cast<LwpTable*>(pContent)->GetSuperTableLayout());
+ }
+
+ return nullptr;
+}
+
+/**
+ * @descr Find footnote contents
+ */
+LwpContent* LwpFootnote::FindFootnoteContent()
+{
+ LwpContent* pContent = dynamic_cast<LwpContent*>(m_Content.obj().get());
+ //if the content has layout, the content has footnote contents;
+ //or looking for the celllayout and return the footnote contents.
+ if (pContent && pContent->GetLayout(nullptr).is())
+ return pContent;
+
+ LwpCellLayout* pCellLayout = GetCellLayout();
+ if(pCellLayout)
+ {
+ pContent = dynamic_cast<LwpContent*>(pCellLayout->GetContent().obj().get());
+ }
+
+ return pContent;
+}
+
+LwpFootnoteTable::LwpFootnoteTable(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpTable(objHdr, pStrm)
+{
+}
+
+void LwpFootnoteTable::Read()
+{
+ LwpTable::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Read footnote number options information
+ */
+void LwpFootnoteNumberOptions::Read(LwpObjectStream *pObjStrm)
+{
+ m_nFlag = pObjStrm->QuickReaduInt16();
+ m_nStartingNumber = pObjStrm->QuickReaduInt16();
+ m_LeadingText.Read(pObjStrm);
+ m_TrailingText.Read(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Read footnote separator options information
+ */
+void LwpFootnoteSeparatorOptions::Read(LwpObjectStream *pObjStrm)
+{
+ m_nFlag = pObjStrm->QuickReaduInt16();
+ m_nLength = pObjStrm->QuickReaduInt32();
+ m_nIndent = pObjStrm->QuickReaduInt32();
+ m_nAbove = pObjStrm->QuickReaduInt32();
+ m_nBelow = pObjStrm->QuickReaduInt32();
+ m_BorderStuff.Read(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+
+LwpFootnoteOptions::LwpFootnoteOptions(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpObject(objHdr, pStrm)
+ , m_nFlag(0)
+{
+}
+
+LwpFootnoteOptions::~LwpFootnoteOptions()
+{
+
+}
+
+/**
+ * @descr Register footnote options object
+ */
+void LwpFootnoteOptions::Read()
+{
+ m_nFlag = m_pObjStrm->QuickReaduInt16();
+ m_FootnoteNumbering.Read(m_pObjStrm.get());
+ m_EndnoteDivisionNumbering.Read(m_pObjStrm.get());
+ m_EndnoteDivisionGroupNumbering.Read(m_pObjStrm.get());
+ m_EndnoteDocNumbering.Read(m_pObjStrm.get());
+ m_FootnoteSeparator.Read(m_pObjStrm.get());
+ m_FootnoteContinuedSeparator.Read(m_pObjStrm.get());
+ m_ContinuedOnMessage.Read(m_pObjStrm.get());
+ m_ContinuedFromMessage.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register footnote options style
+ */
+void LwpFootnoteOptions::RegisterStyle()
+{
+ RegisterFootnoteStyle();
+ RegisterEndnoteStyle();
+}
+
+/**
+ * @descr Register footnote configuration information
+ */
+void LwpFootnoteOptions::RegisterFootnoteStyle()
+{
+ std::unique_ptr<XFFootnoteConfig> xFootnoteConfig(new XFFootnoteConfig);
+ xFootnoteConfig->SetStartValue(m_FootnoteNumbering.GetStartingNumber() -1);
+ xFootnoteConfig->SetNumPrefix(m_FootnoteNumbering.GetLeadingText());
+ xFootnoteConfig->SetNumSuffix(m_FootnoteNumbering.GetTrailingText());
+ if(m_FootnoteNumbering.GetReset() == LwpFootnoteNumberOptions::RESET_PAGE)
+ {
+ xFootnoteConfig->SetRestartOnPage();
+ }
+ if(GetContinuedFrom())
+ {
+ xFootnoteConfig->SetMessageFrom(GetContinuedFromMessage());
+ }
+ if(GetContinuedOn())
+ {
+ xFootnoteConfig->SetMessageOn(GetContinuedOnMessage());
+ }
+
+ xFootnoteConfig->SetMasterPage( m_strMasterPage);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->SetFootnoteConfig(xFootnoteConfig.release());
+}
+
+/**
+ * @descr Register endnote configuration information
+ */
+void LwpFootnoteOptions::RegisterEndnoteStyle()
+{
+ std::unique_ptr<XFEndnoteConfig> xEndnoteConfig(new XFEndnoteConfig);
+ xEndnoteConfig->SetStartValue(m_EndnoteDocNumbering.GetStartingNumber() -1);
+ OUString message = m_EndnoteDocNumbering.GetLeadingText();
+ if(message.isEmpty())
+ {
+ message = "[";//default prefix
+ }
+ xEndnoteConfig->SetNumPrefix(message);
+ message = m_EndnoteDocNumbering.GetTrailingText();
+ if(message.isEmpty())
+ {
+ message = "]";//default suffix
+ }
+ xEndnoteConfig->SetNumSuffix(message);
+ if(m_EndnoteDocNumbering.GetReset() == LwpFootnoteNumberOptions::RESET_PAGE)
+ {
+ xEndnoteConfig->SetRestartOnPage();
+ }
+
+ xEndnoteConfig->SetMasterPage( m_strMasterPage);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->SetEndnoteConfig(xEndnoteConfig.release());
+}
+
+/**
+ * @descr Get continue on message
+ */
+OUString LwpFootnoteOptions::GetContinuedOnMessage() const
+{
+ if(m_ContinuedOnMessage.HasValue())
+ {
+ return m_ContinuedOnMessage.str();
+ }
+ // else return default message
+ return STRID_FOOTCONTINUEDON;
+}
+
+/**
+ * @descr Get continue from message
+ */
+OUString LwpFootnoteOptions::GetContinuedFromMessage() const
+{
+ if(m_ContinuedFromMessage.HasValue())
+ {
+ return m_ContinuedFromMessage.str();
+ }
+ // else return default message
+ return STRID_FOOTCONTINUEDFROM;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfootnote.hxx b/lotuswordpro/source/filter/lwpfootnote.hxx
new file mode 100644
index 000000000..5163204e3
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfootnote.hxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * footnote
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFOOTNOTE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFOOTNOTE_HXX
+
+#include <lwpfrib.hxx>
+#include <lwpobj.hxx>
+#include "lwpsection.hxx"
+#include "lwpborderstuff.hxx"
+#include "lwptable.hxx"
+
+// Footnote types are built up from these numbers
+#define FN_MASK_ENDNOTE 0x80
+#define FN_MASK_SEPARATE 0x40
+#define FN_MASK_DEACTIVATED 0x20
+#define FN_MASK_BASE (0x0f | FN_MASK_ENDNOTE)
+#define FN_BASE_DONTCARE 0
+#define FN_BASE_FOOTNOTE 1
+#define FN_BASE_DIVISION (2 | FN_MASK_ENDNOTE)
+#define FN_BASE_DIVISIONGROUP (3 | FN_MASK_ENDNOTE)
+#define FN_BASE_DOCUMENT (4 | FN_MASK_ENDNOTE)
+
+// Here are the real footnote types
+#define FN_DONTCARE (FN_BASE_DONTCARE)
+#define FN_FOOTNOTE (FN_BASE_FOOTNOTE)
+#define FN_DIVISION (FN_BASE_DIVISION)
+#define FN_DIVISION_SEPARATE (FN_BASE_DIVISION | FN_MASK_SEPARATE)
+#define FN_DIVISIONGROUP (FN_BASE_DIVISIONGROUP)
+#define FN_DIVISIONGROUP_SEPARATE (FN_BASE_DIVISIONGROUP | FN_MASK_SEPARATE)
+#define FN_DOCUMENT (FN_BASE_DOCUMENT)
+#define FN_DOCUMENT_SEPARATE (FN_BASE_DOCUMENT | FN_MASK_SEPARATE)
+#define STRID_FOOTCONTINUEDFROM "Continued from previous page..."
+#define STRID_FOOTCONTINUEDON "Continued on next page..."
+//Footnote table types, the string may have to do with local language
+#define STR_DivisionFootnote "DivisionFootnote"
+#define STR_DivisionEndnote "DivisionEndnote"
+#define STR_DivisionGroupEndnote "DivisionGroupEndnote"
+#define STR_DocumentEndnote "DocumentEndnote"
+
+/**
+ * @brief Footnote frib object
+*/
+class LwpFootnote;
+class LwpFribFootnote: public LwpFrib
+{
+
+public:
+ explicit LwpFribFootnote(LwpPara* pPara );
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ void RegisterNewStyle();
+ void XFConvert(XFContentContainer* pCont);
+ LwpFootnote* GetFootnote();
+
+private:
+ LwpObjectID m_Footnote;
+};
+
+/**
+ * @brief VO_FOOTNOTE object
+*/
+class LwpEnSuperTableLayout;
+class LwpCellLayout;
+class LwpDocument;
+class LwpTable;
+class LwpFootnote : public LwpOrderedObject
+{
+public:
+ LwpFootnote(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFootnote() override;
+ void RegisterStyle() override;
+ void XFConvert(XFContentContainer * pCont) override;
+protected:
+ void Read() override;
+private:
+ sal_uInt16 m_nType;
+ sal_uInt16 m_nRow;
+ LwpObjectID m_Content;
+public:
+ sal_uInt16 GetType() const { return m_nType;}
+private:
+ LwpCellLayout* GetCellLayout();
+ LwpDocument* GetFootnoteTableDivision();
+ LwpDocument* GetEndnoteDivision(LwpDocument* pPossible);
+ LwpEnSuperTableLayout* FindFootnoteTableLayout();
+ LwpContent* FindFootnoteContent();
+ OUString GetTableClass() const;
+};
+
+/**
+ * @brief VO_FOOTNOTETABLE object
+*/
+class LwpFootnoteTable : public LwpTable
+{
+public:
+ LwpFootnoteTable(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief footnote number options information
+*/
+class LwpFootnoteNumberOptions
+{
+public:
+ LwpFootnoteNumberOptions()
+ : m_nFlag(0)
+ , m_nStartingNumber(0)
+ {}
+
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ sal_uInt16 m_nFlag;
+ sal_uInt16 m_nStartingNumber;
+ LwpAtomHolder m_LeadingText;
+ LwpAtomHolder m_TrailingText;
+public:
+ enum // for flag
+ {
+ RESET_DOCUMENT = 0x00, // i.e., never reset the numbering
+ RESET_PAGE = 0x01,
+ RESET_DIVISION = 0x02,
+ RESET_DIVISIONGROUP = 0x04,
+ RESET_MASK = (RESET_PAGE | RESET_DIVISION | RESET_DIVISIONGROUP |
+ RESET_DOCUMENT),
+ SUPERSCRIPT_REFERENCE = 0x10
+ };
+public:
+ sal_uInt16 GetStartingNumber() const { return m_nStartingNumber;}
+ OUString const & GetLeadingText() const { return m_LeadingText.str();}
+ OUString const & GetTrailingText() const { return m_TrailingText.str();}
+ sal_uInt16 GetReset() const { return static_cast<sal_uInt16>(m_nFlag & RESET_MASK);}
+};
+
+/**
+ * @brief footnote separator options information
+*/
+class LwpFootnoteSeparatorOptions
+{
+public:
+ LwpFootnoteSeparatorOptions()
+ : m_nFlag(0)
+ , m_nLength(0)
+ , m_nIndent(0)
+ , m_nAbove(0)
+ , m_nBelow(0)
+ {}
+
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ sal_uInt16 m_nFlag;
+ sal_uInt32 m_nLength;
+ sal_uInt32 m_nIndent;
+ sal_uInt32 m_nAbove;
+ sal_uInt32 m_nBelow;
+ LwpBorderStuff m_BorderStuff;
+public:
+ enum // for flag
+ {
+ HAS_SEPARATOR = 0x01,
+ CUSTOM_LENGTH = 0x02
+ };
+ sal_uInt32 GetLength() const { return m_nLength;}
+ sal_uInt32 GetIndent() const { return m_nIndent;}
+ sal_uInt32 GetAbove() const { return m_nAbove;}
+ sal_uInt32 GetBelow() const { return m_nBelow;}
+ bool HasCustomLength() const { return (m_nFlag & CUSTOM_LENGTH) != 0;}
+ bool HasSeparator() const { return (m_nFlag & HAS_SEPARATOR) != 0;}
+ float GetTopBorderWidth(){ return m_BorderStuff.GetSideWidth(LwpBorderStuff::TOP);}
+ LwpColor GetTopBorderColor(){ return m_BorderStuff.GetSideColor(LwpBorderStuff::TOP);}
+};
+
+/**
+ * @brief VO_FOOTNOTEOPTS object
+*/
+class LwpFootnoteOptions final : public LwpObject
+{
+public:
+ LwpFootnoteOptions(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ void RegisterStyle() override;
+private:
+ void Read() override;
+ void RegisterFootnoteStyle();
+ void RegisterEndnoteStyle();
+ virtual ~LwpFootnoteOptions() override;
+
+ sal_uInt16 m_nFlag;
+ LwpFootnoteNumberOptions m_FootnoteNumbering;
+ LwpFootnoteNumberOptions m_EndnoteDivisionNumbering;
+ LwpFootnoteNumberOptions m_EndnoteDivisionGroupNumbering;
+ LwpFootnoteNumberOptions m_EndnoteDocNumbering;
+ LwpFootnoteSeparatorOptions m_FootnoteSeparator;
+ LwpFootnoteSeparatorOptions m_FootnoteContinuedSeparator;
+ LwpAtomHolder m_ContinuedOnMessage;
+ LwpAtomHolder m_ContinuedFromMessage;
+ OUString m_strMasterPage;
+ enum
+ {
+ FO_REPEAT = 0x0001,
+ FO_CONTINUEFROM = 0x0002,
+ FO_CONTINUEON = 0x0004,
+ FO_ON_CENTER = 0x0008,
+ FO_ON_RIGHT = 0x0010,
+ FO_ON_ALIGNMASK = FO_ON_CENTER | FO_ON_RIGHT,
+ FO_FROM_CENTER = 0x0020,
+ FO_FROM_RIGHT = 0x0040,
+ FO_FROM_ALIGNMASK = FO_FROM_CENTER | FO_FROM_RIGHT
+ };
+
+public:
+ LwpFootnoteSeparatorOptions& GetFootnoteSeparator(){ return m_FootnoteSeparator;}
+ bool GetContinuedFrom() const { return ((m_nFlag & FO_CONTINUEFROM) != 0);}
+ bool GetContinuedOn() const { return ((m_nFlag & FO_CONTINUEON) != 0);}
+ OUString GetContinuedOnMessage() const;
+ OUString GetContinuedFromMessage() const;
+ void SetMasterPage(const OUString& strMasterPage){ m_strMasterPage = strMasterPage;}
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
new file mode 100644
index 000000000..ce6b8f33d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -0,0 +1,534 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpfoundry.hxx>
+#include <lwpfilehdr.hxx>
+#include "lwpdoc.hxx"
+#include "lwpmarker.hxx"
+#include "lwpholder.hxx"
+#include "lwpbulletstylemgr.hxx"
+#include "lwpcontent.hxx"
+#include "lwpvpointer.hxx"
+#include "lwpsection.hxx"
+#include "lwpcharacterstyle.hxx"
+#include <lwpglobalmgr.hxx>
+#include <lwpobjtags.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include "lwplayout.hxx"
+
+#include <osl/diagnose.h>
+
+LwpFoundry::LwpFoundry(LwpObjectStream *pStrm, LwpDocument* pDoc)
+ : m_pDoc(pDoc)
+ , m_bRegisteredAll(false)
+{
+ Read(pStrm);
+ m_xDropcapMgr.reset(new LwpDropcapMgr);
+ m_xBulletStyleMgr.reset(new LwpBulletStyleMgr);
+ m_xBulletStyleMgr->SetFoundry(this);
+}
+
+LwpFoundry::~LwpFoundry()
+{
+}
+
+void LwpFoundry::Read(LwpObjectStream *pStrm)
+{
+ if (!m_pDoc->IsChildDoc())
+ {
+ LwpVersionManager::Read(pStrm);
+ }
+ m_ObjMgr.Read(pStrm);
+
+ m_MarkerHead.ReadIndexed(pStrm);
+ m_FootnoteMgr.ReadIndexed(pStrm);
+
+ m_NumMgr.Read(pStrm);
+ m_BulMgr.Read(pStrm);
+
+ m_SectionList.Read(pStrm);
+ m_Layout.ReadIndexed(pStrm);
+
+ ReadStyles(pStrm);
+
+ m_BookMarkHead.ReadIndexed(pStrm);
+ m_DdeLinkHead.ReadIndexed(pStrm);
+ m_DirtBagHead.ReadIndexed(pStrm);
+ m_NamedOutlineSeqHead.ReadIndexed(pStrm);
+
+ m_EnumLayoutHead.ReadIndexed(pStrm);
+ m_EnumLayoutTail.ReadIndexed(pStrm);
+ m_NamedObjects.ReadIndexed(pStrm);
+
+ m_nLastClickHere = pStrm->QuickReaduInt32();
+ m_SmartTextMgr.ReadIndexed(pStrm);
+
+ m_ContentMgr.Read(pStrm);
+ m_FontMgr.Read(pStrm);
+
+ if (!m_pDoc->IsChildDoc() && LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_xPieceMgr.reset(new LwpPieceManager);
+ m_xPieceMgr->Read(pStrm);
+ }
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_DftDropCapStyle.ReadIndexed(pStrm);
+ }
+ if( LwpFileHeader::m_nFileRevision >= 0x000F)
+ {
+ m_DftHeaderStyle.ReadIndexed(pStrm);
+ m_DftFooterStyle.ReadIndexed(pStrm);
+ }
+ pStrm->SkipExtra();
+
+ m_xStyleMgr.reset(new LwpStyleManager);
+ m_xStyleMgr->SetFoundry(this);
+}
+
+void LwpFoundry::ReadStyles(LwpObjectStream *pStrm)
+{
+ m_TextStyle.ReadIndexed(pStrm);
+ m_DefaultTextStyle.ReadIndexed(pStrm);
+ m_DefaultClickStyle.ReadIndexed(pStrm);
+ m_PageStyle.ReadIndexed(pStrm);
+ m_FrameStyle.ReadIndexed(pStrm);
+
+ m_TableStyle.ReadIndexed(pStrm);
+ m_CellStyle.ReadIndexed(pStrm);
+ m_DftFrameStyle.ReadIndexed(pStrm);
+ m_DftPageStyle.ReadIndexed(pStrm);
+ m_DftTableStyle.ReadIndexed(pStrm);
+
+ m_DftCellStyle.ReadIndexed(pStrm);
+ m_DftColumnStyle.ReadIndexed(pStrm);
+ m_DftLeftColumnStyle.ReadIndexed(pStrm);
+ m_DftRighColumnStyle.ReadIndexed(pStrm);
+
+}
+
+void LwpFoundry::RegisterAllLayouts()
+{
+ if (m_bRegisteredAll)
+ {
+ OSL_FAIL("recursive LwpFoundry::RegisterAllLayouts!");
+ return;
+ }
+
+ m_bRegisteredAll = true;
+
+ //Register CellStyle
+ rtl::Reference<LwpObject> pStyle = m_CellStyle.obj();
+ if( pStyle.is() )
+ {
+ pStyle->SetFoundry(this);
+ pStyle->DoRegisterStyle();
+ }
+
+ //register content page layout list: Layout
+ pStyle = m_Layout.obj();
+ if( pStyle.is() )
+ {
+ pStyle->SetFoundry(this);
+ pStyle->DoRegisterStyle();
+ }
+
+ //Register page style layout list: PageStyle, such as "Default Page"
+ pStyle = m_PageStyle.obj();
+ if( pStyle.is() )
+ {
+ pStyle->SetFoundry(this);
+ pStyle->DoRegisterStyle();
+ }
+
+ //Register FrameStyle
+ pStyle = m_FrameStyle.obj();
+ if( pStyle.is() )
+ {
+ pStyle->SetFoundry(this);
+ pStyle->DoRegisterStyle();
+ }
+
+}
+
+LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
+{
+ LwpDLVListHeadHolder* pHeadHolder= dynamic_cast
+ <LwpDLVListHeadHolder*>(m_BookMarkHead.obj().get());
+
+ if (!pHeadHolder)
+ return nullptr;
+
+ LwpObjectID* pObjID = &pHeadHolder->GetHeadID();
+ LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(pObjID->obj().get());
+
+ while (pBookMark)
+ {
+ if (pBookMark->IsRightMarker(objMarker))
+ return pBookMark;
+ pObjID = &pBookMark->GetNext();
+ pBookMark = dynamic_cast<LwpBookMark*>(pObjID->obj().get());
+ }
+ return nullptr;
+}
+
+/**
+* @descr: Get next content
+*
+*/
+LwpContent* LwpFoundry::EnumContents(LwpContent * pContent)
+{
+ return GetContentManager().EnumContents(pContent);
+}
+
+/**
+* @descr: Get next section
+*
+*/
+LwpSection* LwpFoundry::EnumSections(LwpSection * pSection)
+{
+ return static_cast<LwpSection*>(m_SectionList.Enumerate(pSection));
+}
+
+/**
+* @descr: Get default text style id
+*
+*/
+LwpObjectID * LwpFoundry::GetDefaultTextStyle()
+{
+ LwpVersionedPointer * pPointer = dynamic_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
+ if (!pPointer)
+ return nullptr;
+
+ return &pPointer->GetPointer();
+}
+
+/**
+* @descr: Get paragraph style object id according to its style name
+*
+*/
+LwpObjectID * LwpFoundry::FindParaStyleByName(const OUString& name)
+{
+ //Register all text styles: para styles, character styles
+ LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(GetTextStyleHead().obj().get());
+ if(pParaStyleHolder)
+ {
+ LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
+ while(pParaStyle)
+ {
+ OUString strName = pParaStyle->GetName().str();
+ if(strName == name)
+ return &pParaStyle->GetObjectID();
+ pParaStyle = dynamic_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
+ }
+ }
+
+ return nullptr;
+}
+
+/**
+* @descr: Get style name registered according the original style name
+*
+*/
+OUString LwpFoundry::FindActuralStyleName(const OUString& name)
+{
+ LwpObjectID* pID = FindParaStyleByName(name);
+ if(pID)
+ {
+ IXFStyle* pStyle = GetStyleManager()->GetStyle(*pID);
+ if(pStyle)
+ {
+ return pStyle->GetStyleName();
+ }
+ }
+
+ return name;
+}
+
+void LwpVersionManager::Read(LwpObjectStream *pStrm)
+{
+ // TODO: skip the data for prototype
+ Skip(pStrm);
+}
+
+void LwpVersionManager::Skip(LwpObjectStream *pStrm)
+{
+ pStrm->QuickReaduInt32();
+ sal_uInt16 Count = pStrm->QuickReaduInt16();
+
+ while(Count--)
+ {
+ sal_uInt32 tag = pStrm->QuickReaduInt32();
+ switch(tag)
+ {
+ case TAG_USER_VERSION:
+ // TODO: skip the CUserVersionControl
+ pStrm->SeekRel(pStrm->QuickReaduInt16());
+ break;
+
+ default:
+ pStrm->SeekRel(pStrm->QuickReaduInt16());
+ pStrm->SkipExtra();
+ break;
+ }
+ }
+ pStrm->SkipExtra();
+}
+
+void LwpObjectManager::Read(LwpObjectStream *pStrm)
+{
+
+ LwpObjectID dummy;
+ dummy.Read(pStrm);
+ // TODO: judge if we need to set the cDelta by the dummy id
+
+ m_Division.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+}
+
+void LwpNumberManager::Read(LwpObjectStream *pStrm)
+{
+ m_TableRange.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+}
+
+void LwpBulletManager::Read(LwpObjectStream *pStrm)
+{
+ m_Head.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+}
+
+void LwpContentManager::Read(LwpObjectStream *pStrm)
+{
+ m_ContentList.ReadIndexed(pStrm);
+
+ // TODO: to judge the file revision
+
+ m_EnumHead.ReadIndexed(pStrm);
+ m_EnumTail.ReadIndexed(pStrm);
+
+ m_OleObjCount.ReadIndexed(pStrm);
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_GrapHead.ReadIndexed(pStrm);
+ m_GrapTail.ReadIndexed(pStrm);
+ m_OleHead.ReadIndexed(pStrm);
+ m_OleTail.ReadIndexed(pStrm);
+ }
+
+ pStrm->SkipExtra();
+}
+
+/**
+* @descr: Get next content
+*
+*/
+LwpContent* LwpContentManager::EnumContents(LwpContent* pContent)
+{
+ if(pContent)
+ return pContent->GetNextEnumerated();
+ LwpVersionedPointer* pPointer = dynamic_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
+ return pPointer ? dynamic_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : nullptr;
+}
+
+void LwpPieceManager::Read(LwpObjectStream *pStrm)
+{
+ m_GeometryPieceList.ReadIndexed(pStrm);
+ m_ScalePieceList.ReadIndexed(pStrm);
+ m_MarginsPieceList.ReadIndexed(pStrm);
+ m_ColumnsPieceList.ReadIndexed(pStrm);
+ m_BorderStuffPieceList.ReadIndexed(pStrm);
+
+ m_GutterStuffPieceList.ReadIndexed(pStrm);
+ m_BackgroundStuffPieceList.ReadIndexed(pStrm);
+ m_JoinStuffPieceList.ReadIndexed(pStrm);
+ m_ShadowPieceList.ReadIndexed(pStrm);
+ m_NumericsPieceList.ReadIndexed(pStrm);
+
+ m_RelativityPieceList.ReadIndexed(pStrm);
+ m_AlignmentPieceList.ReadIndexed(pStrm);
+ m_IndentPieceList.ReadIndexed(pStrm);
+ m_ParaBorderPieceList.ReadIndexed(pStrm);
+ m_SpacingPieceList.ReadIndexed(pStrm);
+
+ m_BreaksPieceList.ReadIndexed(pStrm);
+ m_NumberingPieceList.ReadIndexed(pStrm);
+ m_TabPieceList.ReadIndexed(pStrm);
+ m_CharacterBorderPieceList.ReadIndexed(pStrm);
+ m_AmikakePieceList.ReadIndexed(pStrm);
+
+ if(pStrm->CheckExtra())
+ {
+ m_ParaBackgroundPieceList.ReadIndexed(pStrm);
+ m_ExternalBorderStuffPieceList.ReadIndexed(pStrm);
+ m_ExternalJoinStuffPieceList.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+ }
+}
+
+void LwpOrderedObjectManager::Read(LwpObjectStream *pStrm)
+{
+ m_Head.ReadIndexed(pStrm);
+}
+
+/**
+* @descr: Get next orderedobject, copy from lwp source code
+*
+*/
+LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
+{
+ // If Last has a next, return it.
+ if(pLast && !pLast->GetNext().IsNull())
+ return dynamic_cast<LwpOrderedObject*>(pLast->GetNext().obj().get());
+
+ LwpListList* pList = nullptr;
+ if(pLast)
+ {
+ // We're at the end of Last's list (not list's list).
+ // Start with the next active list
+ pList = dynamic_cast<LwpListList*>(pLast->GetListList().obj().get());
+ pList= GetNextActiveListList(pList);
+ }
+ else
+ {
+ // Start with the first active ListList
+ pList = GetNextActiveListList(nullptr);
+ }
+
+ if(pList)
+ {
+ return dynamic_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
+ }
+
+ return nullptr;
+}
+
+/**
+* @descr: Get next listlist object, copy from lwp source code
+*
+*/
+LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
+{
+ LwpListList* pList = nullptr;
+ if(pLast)
+ pList = dynamic_cast<LwpListList*>(pLast->GetNext().obj().get());
+ else
+ {
+ LwpDLVListHeadHolder* pHeadHolder= dynamic_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
+ if(pHeadHolder)
+ {
+ pList = dynamic_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
+ }
+ }
+
+ while(pList)
+ {
+ LwpContent* pContent = dynamic_cast<LwpContent*>(pList->GetObject().obj().get());
+ if (pContent && pContent->HasNonEmbeddedLayouts() && !pContent->IsStyleContent())
+ return pList;
+ pList = dynamic_cast<LwpListList*>(pList->GetNext().obj().get());
+ }
+ return nullptr;
+}
+
+LwpStyleManager::LwpStyleManager()
+ : m_pFoundry(nullptr)
+{
+}
+
+LwpStyleManager::~LwpStyleManager()
+{
+ m_StyleList.clear();
+}
+
+/*
+VO_PARASTYLE/VO_CHARACTERSTYLE call this method to add its created style to XFStyleManager
+1. Add the style to XFStyleManager, and return the <office:styles> style name
+2. Add it to LwpParaStyleMap.
+Prerequisite: pStyle has been created and all properties has been set to it.
+Return the XFStyle* added by XFStyleManager
+*/
+void LwpStyleManager::AddStyle(LwpObjectID styleObjID, std::unique_ptr<IXFStyle> pNewStyle)
+{
+ assert(pNewStyle);
+ //pStyle may change if same style is found in XFStyleManager
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ auto pStyle = pXFStyleManager->AddStyle(std::move(pNewStyle)).m_pStyle;
+ m_StyleList.emplace(styleObjID, pStyle);
+}
+
+/*
+Called by VO_PARA or other objects to get style name based on the Style object ID
+1) Get style from LwpParaStyleMap based on the LwpObjectID of VO_PARASTYLE.
+Prerequisite: VO_PARASTYLE/VO_CHARACTERSTYLE should call AddStyle first.
+Return empty string if no style found.
+*/
+IXFStyle* LwpStyleManager::GetStyle(const LwpObjectID &styleObjID)
+{
+ LwpStyleMap::const_iterator it = m_StyleList.find(styleObjID);
+ if (it != m_StyleList.end()) {
+ return((*it).second);
+ }
+ return nullptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
new file mode 100644
index 000000000..f2a735387
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -0,0 +1,1279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * the class for VO_FrameLayout
+ ************************************************************************/
+
+#include <memory>
+#include <lwpfilehdr.hxx>
+#include "lwpframelayout.hxx"
+#include "lwppara.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xffloatframe.hxx>
+#include <xfilter/xfrubystyle.hxx>
+#include "lwppagelayout.hxx"
+#include "lwpoleobject.hxx"
+#include "lwptablelayout.hxx"
+#include "lwpgrfobj.hxx"
+#include <lwpglobalmgr.hxx>
+
+LwpFrame::LwpFrame(LwpPlacableLayout* pLayout):m_pLayout(pLayout)
+{
+}
+
+LwpFrame::~LwpFrame()
+{
+}
+/**
+* @descr: parse frame
+* @param: register frame style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::RegisterStyle(std::unique_ptr<XFFrameStyle>& rFrameStyle)
+{
+ ApplyWrapType(rFrameStyle.get());
+ ApplyMargins(rFrameStyle.get());
+ ApplyPadding(rFrameStyle.get());
+ ApplyBorders(rFrameStyle.get());
+ ApplyColumns(rFrameStyle.get());
+ ApplyShadow(rFrameStyle.get());
+ ApplyBackGround(rFrameStyle.get());
+ ApplyWatermark(rFrameStyle.get());
+ ApplyProtect(rFrameStyle.get());
+ ApplyTextDir(rFrameStyle.get());
+ ApplyPosType(rFrameStyle.get());
+
+ rFrameStyle->SetStyleName(m_pLayout->GetName().str());
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(rFrameStyle)).m_pStyle->GetStyleName();
+ m_pLayout->SetStyleName(m_StyleName);
+}
+
+/**
+* @descr: parse frame and set frame properties
+* @param: pXFFrame - XFFrame object
+* @param: nPageNo - the page number that the frame anchors
+*
+*/
+ void LwpFrame::Parse(XFFrame* pXFFrame, sal_Int32 nPageNo)
+ {
+ //set the frame style name
+ pXFFrame->SetStyleName(m_StyleName);
+
+ //SetAnchorType and position,if it's page anchor,set the page number.
+ ParseAnchorType(pXFFrame);
+ if(nPageNo>0)
+ {
+ pXFFrame->SetAnchorPage(nPageNo);
+ }
+
+ //Set frame Name
+ OUString aFrameName = m_pLayout->GetName().str();
+ if(!aFrameName.isEmpty())
+ {
+ //cause the bug of SODC, the linkframe name can not be "Frame1", so I change the frame name
+ /*if(aFrameName.equals("Frame1"))
+ {
+ aFrameName = "Frame1_COPY";
+ }
+ pXFFrame->SetName(aFrameName);*/
+ pXFFrame->SetName(m_StyleName);
+ }
+
+ LwpLayoutGeometry* pLayoutGeo = m_pLayout->GetGeometry();
+ //Set frame Width and height
+ if(pLayoutGeo)
+ {
+ double fWidth = m_pLayout->GetWidth();
+ double fHeight = m_pLayout->GetHeight();
+
+ pXFFrame->SetWidth( fWidth );
+ pXFFrame->SetHeight( fHeight );
+
+ //Get content obj;
+ /*LwpObject* pObj =*/ m_pLayout->GetContent().obj();
+ if(m_pLayout->IsGroupHead()&&(m_pLayout->IsMinimumHeight()))
+ {
+ //process grouplayout height. there is problems now
+ pXFFrame->SetHeight( fHeight );
+ }
+ /*
+ else if(m_pLayout->IsFitGraphic() && pObj && pObj->GetTag() == VO_GRAPHIC)
+ {
+ //If is graphic, get original size and set it;
+ LwpGraphicObject* pGrpObj = static_cast<LwpGraphicObject*>(pObj);
+ long nHeight =0, nWidth =0;
+ pGrpObj->GetGrafOrgSize(nWidth, nHeight);
+ //add margins to the width and height;
+ fWidth = (double)nWidth/TWIPS_PER_CM + m_pLayout->GetMarginsValue(MARGIN_LEFT) + m_pLayout->GetMarginsValue(MARGIN_RIGHT);
+ fHeight = (double)nHeight/TWIPS_PER_CM + m_pLayout->GetMarginsValue(MARGIN_TOP) + m_pLayout->GetMarginsValue(MARGIN_BOTTOM);
+ pXFFrame->SetWidth(fWidth);
+ pXFFrame->SetHeight(fHeight);
+ }
+ */
+ else if(m_pLayout->IsAutoGrow())
+ {
+ pXFFrame->SetMinHeight( fHeight );
+ }
+ }
+
+ if(m_pLayout->IsFrame())
+ {
+ //Set frame link. Only frame layout has this feature
+ LwpFrameLayout* pLayout= static_cast<LwpFrameLayout*>(m_pLayout);
+ pXFFrame->SetNextLink(pLayout->GetNextLinkName());
+ }
+
+ }
+/**
+* @descr: parse frame relative to page, frame or cell
+* @param: pCont - content container which contains the frame
+*
+*/
+ void LwpFrame::XFConvert(XFContentContainer* pCont)
+ {
+ // parse the frame which anchor to page
+ rtl::Reference<LwpVirtualLayout> xParent = m_pLayout->GetParentLayout();
+ if (!xParent.is())
+ throw std::runtime_error("missing Parent Layout");
+ if (xParent->IsPage() && xParent->GetParentLayout().is() && xParent->GetParentLayout()->IsPage())
+ {
+ //for mirror page, problems exist if the parent layout is header or footer layout,
+ xParent = xParent->GetParentLayout();
+ }
+ if(m_pLayout->IsAnchorPage()&& xParent->IsPage())
+ {
+ //get parent layout
+ if(m_pLayout->IsUseOnPage())
+ {
+ sal_Int32 nPageNo = xParent->GetPageNumber(m_pLayout->GetUsePage());
+ if(nPageNo>0)
+ m_pLayout->XFConvertFrame(pCont, nPageNo);
+ }
+ else if(m_pLayout->IsUseOnAllPages())
+ {
+ sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+ sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
+ if(nLast > 0)
+ m_pLayout->XFConvertFrame(pCont, nFirst, nLast, true);
+
+ }
+ else if(m_pLayout->IsUseOnAllOddPages()||m_pLayout->IsUseOnAllEvenPages())
+ {
+ sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+ sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
+ if(nLast > 0)
+ {
+ sal_uInt16 first = static_cast<sal_uInt16>(nFirst);
+ if((m_pLayout->IsUseOnAllOddPages() && !LwpTools::IsOddNumber(first))
+ || (m_pLayout->IsUseOnAllEvenPages() && !LwpTools::IsEvenNumber(first)))
+ nFirst++;
+ if(nFirst <= nLast)
+ {
+ m_pLayout->XFConvertFrame(pCont, nFirst, nLast);
+ }
+ }
+ }
+ }
+ else
+ {
+ m_pLayout->XFConvertFrame(pCont);
+ }
+
+ }
+/**
+* @descr: set frame wrap type style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyWrapType(XFFrameStyle *pFrameStyle)
+{
+ enumXFWrap eWrap = enumXFWrapNone;
+ switch(m_pLayout->GetWrapType())
+ {
+ case LwpPlacableLayout::LAY_WRAP_AROUND: //fall through
+ case LwpPlacableLayout::LAY_WRAP_IRREG_BIGGEST:
+ {
+ //In SODC, if Optimal wrap type is used and the distance between the frame object
+ //and page margins is less than 2cm, the text is not wrapped. While there is no this feature in Word Pro
+ //So the optimal wrap type is translated to left side or right side wrap type according to the distance
+ //between the frame object and page margins
+
+ eWrap = enumXFWrapBest;
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
+ if(pParent)
+ {
+ if(IsLeftWider())
+ eWrap = enumXFWrapLeft;
+ else
+ eWrap = enumXFWrapRight;
+ }
+ break;
+ }
+ case LwpPlacableLayout::LAY_NO_WRAP_BESIDE:
+ {
+ eWrap = enumXFWrapNone;
+ break;
+ }
+ case LwpPlacableLayout::LAY_NO_WRAP_AROUND:
+ {
+ eWrap = enumXFWrapRunThrough;
+ if(!m_pLayout->GetBackColor() && !m_pLayout->GetWaterMarkLayout().is())
+ {
+ //pFrameStyle->SetBackGround(sal_True);
+ XFColor aXFColor(0xffffff); //white color
+ pFrameStyle->SetBackColor(aXFColor);
+ pFrameStyle->SetTransparency(100); //transparency
+ }
+ break;
+ }
+ case LwpPlacableLayout::LAY_WRAP_LEFT: //fall through
+ case LwpPlacableLayout::LAY_WRAP_IRREG_LEFT:
+ {
+ eWrap = enumXFWrapLeft;
+ break;
+ }
+ case LwpPlacableLayout::LAY_WRAP_RIGHT: //fall through
+ case LwpPlacableLayout::LAY_WRAP_IRREG_RIGHT:
+ {
+ eWrap = enumXFWrapRight;
+ break;
+ }
+ case LwpPlacableLayout::LAY_WRAP_BOTH: //fall through
+ case LwpPlacableLayout::LAY_WRAP_IRREG_BOTH:
+ {
+ eWrap = enumXFWrapParallel;
+ break;
+ }
+ default:
+ break;
+ }
+
+ //If it is the type of with para above, wrap type is enumXFWrapNone
+ if(m_pLayout->GetRelativeType()==LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE)
+ {
+ eWrap = enumXFWrapNone;
+ }
+
+ pFrameStyle->SetWrapType(eWrap);
+}
+/**
+* @descr: set frame margins style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyMargins(XFFrameStyle *pFrameStyle)
+{
+ double fLeft = m_pLayout->GetExtMarginsValue(MARGIN_LEFT);
+ double fRight = m_pLayout->GetExtMarginsValue(MARGIN_RIGHT);
+ double fTop = m_pLayout->GetExtMarginsValue(MARGIN_TOP);
+ double fBottom = m_pLayout->GetExtMarginsValue(MARGIN_BOTTOM);
+ pFrameStyle->SetMargins(fLeft,fRight,fTop,fBottom);
+}
+/**
+* @descr: set padding border style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyPadding(XFFrameStyle *pFrameStyle)
+{
+ double fLeft = m_pLayout->GetMarginsValue(MARGIN_LEFT);
+ double fRight = m_pLayout->GetMarginsValue(MARGIN_RIGHT);
+ double fTop = m_pLayout->GetMarginsValue(MARGIN_TOP);
+ double fBottom = m_pLayout->GetMarginsValue(MARGIN_BOTTOM);
+ pFrameStyle->SetPadding(fLeft,fRight,fTop,fBottom);
+}
+/**
+* @descr: set frame border style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyBorders(XFFrameStyle *pFrameStyle)
+{
+ std::unique_ptr<XFBorders> pBordres = m_pLayout->GetXFBorders();
+ if(pBordres)
+ {
+ pFrameStyle->SetBorders(std::move(pBordres));
+ }
+}
+/**
+* @descr: set frame columns style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyColumns(XFFrameStyle *pFrameStyle)
+{
+ XFColumns* pColumns = m_pLayout->GetXFColumns();
+ if(pColumns)
+ {
+ pFrameStyle->SetColumns(pColumns);
+ }
+}
+/**
+* @descr: set frame shadow style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyShadow(XFFrameStyle* pFrameStyle)
+{
+ XFShadow* pXFShadow = m_pLayout->GetXFShadow();
+ if(pXFShadow)
+ {
+ pFrameStyle->SetShadow(pXFShadow);
+ }
+}
+/**
+* @descr: set frame back color style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyBackColor(XFFrameStyle* pFrameStyle)
+{
+ LwpColor* pColor = m_pLayout->GetBackColor();
+ if(pColor)
+ {
+ XFColor aXFColor(pColor->To24Color());
+ pFrameStyle->SetBackColor(aXFColor);
+ }
+}
+/**
+* @descr: set frame protect style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyProtect(XFFrameStyle* pFrameStyle)
+{
+ if(m_pLayout->GetIsProtected())
+ {
+ pFrameStyle->SetProtect(true,true,true);
+ }
+}
+/**
+* @descr: set frame text direction style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyTextDir(XFFrameStyle* pFrameStyle)
+{
+ pFrameStyle->SetTextDir(m_pLayout->GetTextDirection());
+}
+/**
+* @descr: set frame position type style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
+{
+ enumXFFrameXPos eXPos = enumXFFrameXPosCenter;
+ enumXFFrameXRel eXRel = enumXFFrameXRelPara;
+ enumXFFrameYPos eYPos = enumXFFrameYPosMiddle;
+ enumXFFrameYRel eYRel = enumXFFrameYRelPara;
+ sal_uInt8 nType = m_pLayout->GetRelativeType();
+ switch(nType)
+ {
+ case LwpLayoutRelativityGuts::LAY_PARENT_RELATIVE://fall through
+ case LwpLayoutRelativityGuts::LAY_CONTENT_RELATIVE:
+ {
+ //anchor to page, frame and cell
+ eXPos = enumXFFrameXPosFromLeft;
+ eXRel = enumXFFrameXRelPage;
+ //set vertical position
+ if(m_pLayout->IsAnchorPage())//in page
+ {
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
+ {
+ //Only anchor to para, the frame can display in header and footer of each page
+ eYPos = enumXFFrameYPosFromTop; //from top
+ eYRel = enumXFFrameYRelPara; //from margin
+ }
+ else
+ {
+ eYPos = enumXFFrameYPosFromTop;
+ eYRel = enumXFFrameYRelPage;
+ }
+ }
+ if(m_pLayout->IsAnchorFrame()) //in frame
+ {
+ eYPos = enumXFFrameYPosFromTop;
+ eYRel = enumXFFrameYRelPage;
+ }
+ if(m_pLayout->IsAnchorCell())
+ {
+ //SODC has no this type, simulate this feature
+ eYPos = enumXFFrameYPosFromTop; //from top
+ eYRel = enumXFFrameYRelPara; //from margin
+ }
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_PARA_RELATIVE: //same page as text
+ {
+ eXPos = enumXFFrameXPosFromLeft;
+ eXRel = enumXFFrameXRelPage;
+ //set vertical position
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && xContainer->IsPage())//in page
+ {
+ //eYPos = enumXFFrameYPosFromTop;
+ //eYRel = enumXFFrameYRelPage;
+ eYPos = enumXFFrameYPosBelow;
+ eYRel = enumXFFrameYRelChar;
+ }
+ else if (xContainer.is() && xContainer->IsFrame()) //in frame
+ {
+ eYPos = enumXFFrameYPosFromTop;
+ eYRel = enumXFFrameYRelPage;
+ }
+ else
+ {
+ eYPos = enumXFFrameYPosFromTop; //from top
+ eYRel = enumXFFrameYRelPara; //from margin
+ }
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_INLINE: //in text
+ {
+ eXPos = enumXFFrameXPosFromLeft; //need not be set
+ eXRel = enumXFFrameXRelParaContent; //need not be set
+ eYPos = enumXFFrameYPosTop; //should be from top
+ eYRel = enumXFFrameYRelBaseLine;
+ sal_Int32 nOffset = m_pLayout->GetBaseLineOffset();
+ if(nOffset>0)
+ {
+ eYPos = enumXFFrameYPosFromTop;
+ }
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE: //with para above
+ {
+ eXPos = enumXFFrameXPosFromLeft;
+ eXRel = enumXFFrameXRelParaContent;
+ //eYPos = enumXFFrameYPosTop;
+ eYPos = enumXFFrameYPosBottom;
+ eYRel = enumXFFrameYRelParaContent;
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL: //in text - vertical
+ {
+ eXPos = enumXFFrameXPosFromLeft;
+ eXRel = enumXFFrameXRelPage;
+ eYPos = enumXFFrameYPosFromTop; //should be below position
+ eYRel = enumXFFrameYRelChar;
+ break;
+ }
+ default:
+ break;
+ }
+
+ pFrameStyle->SetXPosType(eXPos,eXRel);
+ pFrameStyle->SetYPosType(eYPos,eYRel);
+}
+/**
+* @descr: set frame watermark style
+* @param: pFrameStyle - Frame Style object
+*
+*/
+void LwpFrame::ApplyWatermark(XFFrameStyle *pFrameStyle)
+{
+ std::unique_ptr<XFBGImage> xBGImage(m_pLayout->GetXFBGImage());
+ if (xBGImage)
+ {
+ pFrameStyle->SetBackImage(xBGImage);
+ //set watermark transparent
+ rtl::Reference<LwpVirtualLayout> xWaterMarkLayout(m_pLayout->GetWaterMarkLayout());
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xWaterMarkLayout.get());
+ LwpBackgroundStuff* pBackgroundStuff = pLay ? pLay->GetBackgroundStuff() : nullptr;
+ if(pBackgroundStuff && !pBackgroundStuff->IsTransparent())
+ {
+ pFrameStyle->SetTransparency(100);
+ }
+ }
+}
+
+/**
+ * @short Apply pattern fill to frame style
+ * @param pFrameStyle - pointer of XFFrameStyle
+ * @return
+ */
+void LwpFrame::ApplyPatternFill(XFFrameStyle* pFrameStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(m_pLayout->GetFillPattern());
+ if (xXFBGImage)
+ {
+ pFrameStyle->SetBackImage(xXFBGImage);
+ }
+}
+
+/**
+ * @short Apply background to frame style
+ * @param pFrameStyle - pointer of XFFrameStyle
+ * @return
+ */
+void LwpFrame::ApplyBackGround(XFFrameStyle* pFrameStyle)
+{
+ if (!m_pLayout)
+ {
+ return;
+ }
+
+ if (m_pLayout->IsPatternFill())
+ {
+ ApplyPatternFill(pFrameStyle);
+ }
+ else
+ {
+ ApplyBackColor(pFrameStyle);
+ }
+}
+
+/**
+* @descr: set frame size, anchor type, anchored page number
+* @param: pXFFrame - XFFrame object
+*
+*/
+void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
+{
+ //set position
+ double fXOffset = 0;
+ double fYOffset = 0;
+ //set anchor type
+ enumXFAnchor eAnchor = enumXFAnchorNone;
+
+ LwpLayoutGeometry* pLayoutGeo = m_pLayout->GetGeometry();
+ if(pLayoutGeo)
+ {
+ LwpPoint aPoint = pLayoutGeo->GetOrigin();
+ fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
+ fYOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetY());
+ }
+ //set anchor type
+ eAnchor = enumXFAnchorNone;
+ sal_uInt8 nType = m_pLayout->GetRelativeType();
+ switch(nType)
+ {
+ case LwpLayoutRelativityGuts::LAY_PARENT_RELATIVE://fall through
+ case LwpLayoutRelativityGuts::LAY_CONTENT_RELATIVE:
+ {
+ //anchor to page, frame and cell
+ if(m_pLayout->IsAnchorPage())//in page
+ {
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
+ {
+ eAnchor = enumXFAnchorPara;
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
+ }
+ else
+ eAnchor = enumXFAnchorPage;
+ }
+ if(m_pLayout->IsAnchorFrame()) //in frame
+ {
+ eAnchor = enumXFAnchorFrame;
+ }
+ if(m_pLayout->IsAnchorCell()) //in cell
+ {
+ //eAnchor = enumXFAnchorChar;
+ eAnchor = enumXFAnchorPara;
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ LwpMiddleLayout* pContainer = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
+ if (pContainer)
+ {
+ fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ }
+ }
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_PARA_RELATIVE: //same page as text
+ {
+ eAnchor = enumXFAnchorChar;
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && xContainer->IsPage())//in page
+ {
+ //eAnchor = enumXFAnchorPage;
+ eAnchor = enumXFAnchorChar;// to character
+ }
+ else if (xContainer.is() && xContainer->IsFrame()) //in frame
+ {
+ eAnchor = enumXFAnchorFrame;
+ }
+ else if (xContainer.is() && xContainer->IsCell()) //in cell
+ {
+ //eAnchor = enumXFAnchorChar;
+ eAnchor = enumXFAnchorPara;
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
+ }
+ else if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))//in header or footer
+ {
+ eAnchor = enumXFAnchorPara;
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
+ }
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_INLINE: //in text
+ {
+ eAnchor = enumXFAnchorAsChar;
+ sal_Int32 nOffset = m_pLayout->GetBaseLineOffset();
+ if(nOffset>0 && pLayoutGeo)
+ {
+ //experiential value
+ fYOffset =-(m_pLayout->GetGeometryHeight()+2*m_pLayout->GetExtMarginsValue(MARGIN_BOTTOM)-LwpTools::ConvertFromUnitsToMetric(nOffset));
+ }
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE: //with para above
+ {
+ eAnchor = enumXFAnchorPara;
+ break;
+ }
+ case LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL: //in text - vertical
+ {
+ eAnchor = enumXFAnchorChar;
+ //set vertical position
+ double offset = 0;
+
+ //because of the different feature between Word Pro and SODC, I simulate the vertical base offset
+ //between anchor and frame origin using the font height.
+ rtl::Reference<XFFont> pFont = m_pLayout->GetFont();
+ if(pFont.is())
+ {
+ offset = static_cast<double>(pFont->GetFontSize())*CM_PER_INCH/POINTS_PER_INCH;
+ }
+ fYOffset = offset-fYOffset;
+ break;
+ }
+ default:
+ break;
+ }
+
+ pXFFrame->SetX(fXOffset);
+ pXFFrame->SetY(fYOffset);
+ pXFFrame->SetAnchorPage(0);
+ pXFFrame->SetAnchorType(eAnchor);
+}
+
+/**
+ * @descr Calculate the distance between the frame object and the page margins.
+ * And determine which side(left or right) is wider
+ */
+bool LwpFrame::IsLeftWider()
+{
+ rtl::Reference<LwpVirtualLayout> xLayout(m_pLayout->GetContainerLayout());
+ LwpVirtualLayout* pParent = xLayout.get();
+ if (pParent)
+ {
+ LwpPoint aPoint = m_pLayout->GetOrigin();
+ double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
+ double fWidth = m_pLayout->GetWidth();
+ double fWrapLeft = m_pLayout->GetExtMarginsValue(MARGIN_LEFT);
+ double fWrapRight = m_pLayout->GetExtMarginsValue(MARGIN_RIGHT);
+
+ //LwpPoint aParentPoint = pParent->GetOrigin();
+ //double fParentXOffset = LwpTools::ConvertFromUnitsToMetric(aParentPoint.GetX());
+ double fParentWidth = pParent->GetWidth();
+ if(pParent->IsCell())
+ {
+ //Get actual width of this cell layout
+ fParentWidth = static_cast<LwpCellLayout*>(pParent)->GetActualWidth();
+ }
+ double fParentMarginLeft = pParent->GetMarginsValue(MARGIN_LEFT);
+ double fParentMarginRight = pParent->GetMarginsValue(MARGIN_RIGHT);
+
+ double fLeft = fXOffset - fWrapLeft -fParentMarginLeft;
+ double fRight = fParentWidth - fParentMarginRight -(fXOffset + fWidth + fWrapRight);
+ if(fLeft > fRight)
+ return true;
+ }
+ return false;
+}
+
+LwpFrameLink::LwpFrameLink()
+{}
+
+LwpFrameLink::~LwpFrameLink()
+{}
+
+/**
+ * @descr frame link information
+ *
+ */
+void LwpFrameLink::Read(LwpObjectStream* pStrm)
+{
+ m_PreviousLayout.ReadIndexed(pStrm);
+ m_NextLayout.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+}
+
+LwpFrameLayout::LwpFrameLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpPlacableLayout(objHdr, pStrm), m_bGettingMaxWidth(false)
+{
+}
+
+LwpFrameLayout::~LwpFrameLayout()
+{
+}
+
+/**
+ * @descr read frame layout object
+ *
+ */
+void LwpFrameLayout::Read()
+{
+ LwpPlacableLayout::Read();
+ if(LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ if(m_pObjStrm->QuickReaduInt16())
+ {
+ m_Link.Read(m_pObjStrm.get());
+ }
+ }
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr create a xfframe and add into content container
+ * @param: pCont - content container that contains the frame.
+ *
+ */
+ void LwpFrameLayout::XFConvert(XFContentContainer* pCont)
+ {
+ if(!m_pFrame)
+ return;
+
+ //parse the frame which anchor to paragraph
+ if(IsRelativeAnchored())
+ {
+ XFConvertFrame(pCont);
+ }
+ else
+ {
+ m_pFrame->XFConvert(pCont);
+ }
+ }
+/**
+ * @descr create a xfframe and add into content container, called by XFConvert
+ * @param: pCont - content container that contains the frame.
+ * @param: nPageNo - the page number that the frame anchors
+ *
+ */
+void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart , sal_Int32 nEnd, bool bAll )
+{
+ if(!m_pFrame)
+ return;
+
+ rtl::Reference<XFFrame> xXFFrame;
+ if(nEnd < nStart)
+ {
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
+
+ m_pFrame->Parse(xXFFrame.get(), nStart);
+ //if it is a link frame, parse contents only once
+ if(!HasPreviousLinkLayout())
+ {
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if (content.is())
+ {
+ content->DoXFConvert(xXFFrame.get());
+ //set frame size according to ole size
+ ApplyGraphicSize(xXFFrame.get());
+ }
+ }
+ pCont->Add(xXFFrame.get());
+}
+/**
+ * @descr register frame style
+ *
+ */
+void LwpFrameLayout::RegisterStyle()
+{
+ //if it is for water mark, don't register style
+ if (IsForWaterMark())
+ return;
+
+ if (m_pFrame)
+ return;
+
+ //register frame style
+ std::unique_ptr<XFFrameStyle> xFrameStyle(new XFFrameStyle);
+ m_pFrame.reset(new LwpFrame(this));
+ m_pFrame->RegisterStyle(xFrameStyle);
+
+ //register content style
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if (content.is())
+ {
+ content->SetFoundry(m_pFoundry);
+ content->DoRegisterStyle();
+ }
+
+ //register child frame style
+ RegisterChildStyle();
+}
+
+/**
+ * @descr get the name of the frame that current frame links
+ *
+ */
+OUString LwpFrameLayout::GetNextLinkName()
+{
+ OUString aName;
+ LwpObjectID& rObjectID = m_Link.GetNextLayout();
+ if(!rObjectID.IsNull())
+ {
+ LwpLayout* pLayout = dynamic_cast<LwpLayout*>(rObjectID.obj().get());
+ if (pLayout)
+ {
+ LwpAtomHolder& rHolder = pLayout->GetName();
+ aName = rHolder.str();
+ //for division name conflict
+ if(!pLayout->GetStyleName().isEmpty())
+ aName = pLayout->GetStyleName();
+ }
+ }
+ return aName;
+}
+/**
+ * @descr whether current frame is linked by other frame
+ *
+ */
+bool LwpFrameLayout::HasPreviousLinkLayout()
+{
+ LwpObjectID& rObjectID = m_Link.GetPreviousLayout();
+ return !rObjectID.IsNull();
+}
+/**
+ * @descr whether current frame is for water mark. Problem maybe exists by this method, must be tracking
+ *
+ */
+bool LwpFrameLayout::IsForWaterMark()
+{
+ if(m_nBuoyancy >=LAY_BUOYLAYER)
+ {
+ if (m_Content.IsNull())
+ return false;
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if (!content.is())
+ return false;
+ if (content->GetTag() == VO_GRAPHIC)
+ return true;
+ }
+ return false;
+}
+
+/**
+ * @descr Get frame width
+ *
+ */
+double LwpFrameLayout::GetWidth()
+{
+ double fWidth = LwpMiddleLayout::GetWidth();
+ if(IsInlineToMargin() && IsAutoGrowWidth())
+ {
+ //for text field entry when choosing maximize field length
+ fWidth = GetMaxWidth();
+ }
+ return fWidth;
+}
+
+/**
+ * @descr Get frame width when the text field chooses maximize field length
+ *
+ */
+double LwpFrameLayout::GetMaxWidth()
+{
+ if (m_bGettingMaxWidth)
+ throw std::runtime_error("recursive GetMaxWidth");
+
+ m_bGettingMaxWidth = true;
+ double fActualWidth = 0;
+ rtl::Reference<LwpVirtualLayout> xLayout(GetContainerLayout());
+ LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xLayout.get());
+ if (pParent)
+ {
+ LwpPoint aPoint = GetOrigin();
+ double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
+ double fWrapRight = GetExtMarginsValue(MARGIN_RIGHT);
+
+ //Get parent layout width
+ double fParentWidth = pParent->GetWidth();
+ if(pParent->IsCell())
+ {
+ //Get actual width of this cell layout
+ fParentWidth = static_cast<LwpCellLayout*>(pParent)->GetActualWidth();
+ }
+
+ double fParentMarginRight = 0;
+ sal_uInt8 nType = GetRelativeType();
+ if(nType == LwpLayoutRelativityGuts::LAY_INLINE
+ || nType == LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE )
+ {
+ fParentMarginRight = pParent->GetMarginsValue(MARGIN_RIGHT);
+ }
+
+ fActualWidth = fParentWidth - fXOffset - fParentMarginRight - fWrapRight;
+ }
+
+ m_bGettingMaxWidth = false;
+ return fActualWidth;
+}
+
+/**
+ * @descr Set frame size according to graphic size
+ *
+ */
+void LwpFrameLayout::ApplyGraphicSize(XFFrame * pXFFrame)
+{
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if(!(content.is() && (content->GetTag() == VO_GRAPHIC
+ || content->GetTag() == VO_OLEOBJECT )))
+ return;
+
+ LwpGraphicOleObject* pGraOle = static_cast<LwpGraphicOleObject*>(content.get());
+ //Get frame geometry size
+ double fWidth = 0;
+ double fHeight = 0;
+ pGraOle->GetGrafScaledSize(fWidth, fHeight);
+ if( IsFitGraphic())
+ {
+ //graphic scaled sze
+ fWidth += GetMarginsValue(MARGIN_LEFT) + GetMarginsValue(MARGIN_RIGHT);
+ fHeight += GetMarginsValue(MARGIN_TOP) + GetMarginsValue(MARGIN_BOTTOM);
+ }
+ else if(IsAutoGrowDown() || IsAutoGrowUp())
+ {
+ fWidth = GetWidth();
+ fHeight += GetMarginsValue(MARGIN_TOP) + GetMarginsValue(MARGIN_BOTTOM);
+ }
+ else if( IsAutoGrowLeft() || IsAutoGrowRight())
+ {
+ fHeight = GetHeight();
+ fWidth += GetMarginsValue(MARGIN_LEFT) + GetMarginsValue(MARGIN_RIGHT);
+ }
+ else
+ {
+ fWidth = GetWidth();
+ fHeight = GetHeight();
+ }
+ pXFFrame->SetWidth(fWidth);
+ pXFFrame->SetHeight(fHeight);
+}
+
+LwpGroupLayout::LwpGroupLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpPlacableLayout(objHdr, pStrm)
+{
+
+}
+
+LwpGroupLayout::~LwpGroupLayout()
+{
+}
+/**
+ * @descr read group layout object
+ *
+ */
+void LwpGroupLayout::Read()
+{
+ LwpPlacableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+/**
+ * @descr register group frame style
+ *
+ */
+void LwpGroupLayout::RegisterStyle()
+{
+ if (m_pFrame)
+ return;
+
+ //register frame style
+ std::unique_ptr<XFFrameStyle> xFrameStyle(new XFFrameStyle);
+ m_pFrame.reset(new LwpFrame(this));
+ m_pFrame->RegisterStyle(xFrameStyle);
+
+ //register child frame style
+ RegisterChildStyle();
+}
+/**
+ * @descr create a xfframe and add into content container
+ * @param: pCont - content container that contains the frame.
+ *
+ */
+void LwpGroupLayout::XFConvert(XFContentContainer *pCont)
+{
+ if(!m_pFrame)
+ return;
+
+ //parse the frame which anchor to paragraph
+ if(IsRelativeAnchored())
+ {
+ XFConvertFrame(pCont);
+ }
+ else
+ {
+ m_pFrame->XFConvert(pCont);
+ }
+}
+/**
+ * @descr create a xfframe and add into content container, called by XFConvert
+ * @param: pCont - content container that contains the frame.
+ * @param: nPageNo - the page number that the frame anchors
+ *
+ */
+void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart , sal_Int32 nEnd, bool bAll)
+{
+ if(!m_pFrame)
+ return;
+
+ rtl::Reference<XFFrame> xXFFrame;
+ if(nEnd < nStart)
+ {
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
+
+ m_pFrame->Parse(xXFFrame.get(), nStart);
+
+ //add child frame into group
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
+
+ while (pLayout && pLayout != this)
+ {
+ pLayout->DoXFConvert(xXFFrame.get());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+ }
+
+ pCont->Add(xXFFrame.get());
+}
+
+LwpGroupFrame::LwpGroupFrame(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ :LwpContent(objHdr, pStrm)
+{}
+
+LwpGroupFrame::~LwpGroupFrame()
+{}
+
+void LwpGroupFrame::Read()
+{
+ LwpContent::Read();
+ m_pObjStrm->SkipExtra();
+
+}
+
+void LwpGroupFrame::RegisterStyle()
+{
+}
+
+void LwpGroupFrame::XFConvert(XFContentContainer* /*pCont*/)
+{
+}
+
+LwpDropcapLayout::LwpDropcapLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpFrameLayout(objHdr, pStrm), m_nLines(3), m_nChars(1)
+{
+}
+
+void LwpDropcapLayout::Read()
+{
+ LwpFrameLayout::Read();
+ m_nLines = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SeekRel(1);
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpDropcapLayout::Parse(IXFStream* pOutputStream)
+{
+ LwpStory* pStory = static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
+ if (!pStory)
+ return;
+ rtl::Reference<LwpObject> pPara = pStory->GetFirstPara().obj(VO_PARA);
+ if(pPara.is())
+ {
+ pPara->SetFoundry(m_pFoundry);
+ pPara->DoParse(pOutputStream);
+ }
+}
+
+void LwpDropcapLayout::XFConvert(XFContentContainer* pCont)
+{
+ LwpStory* pStory = static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
+ if (pStory)
+ {
+ pStory->SetFoundry(m_pFoundry);
+ pStory->XFConvert(pCont);
+ }
+}
+
+void LwpDropcapLayout::RegisterStyle(LwpFoundry* pFoundry)
+{
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
+ if (pStory)
+ {
+ pStory->SetDropcapFlag(true);
+ pStory->SetFoundry(pFoundry);
+ LwpPara* pPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+ while(pPara)
+ {
+ pPara->SetFoundry(pFoundry);
+ pPara->RegisterStyle();
+ pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
+ }
+ }
+}
+
+/**
+ * @descr do nothing
+ *
+ */
+void LwpDropcapLayout::RegisterStyle()
+{
+}
+
+LwpRubyLayout::LwpRubyLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpFrameLayout(objHdr, pStrm)
+ , m_nPlacement(0)
+ , m_nAlignment(0)
+ , m_nStateFlag(0)
+ , m_nXOffset(0)
+ , m_nYOffset(0)
+{
+}
+
+void LwpRubyLayout::Read()
+{
+ LwpFrameLayout::Read();
+ m_nPlacement = m_pObjStrm->QuickReaduInt8();
+ m_nAlignment = m_pObjStrm->QuickReaduInt8();
+ m_nStateFlag = m_pObjStrm->QuickReaduInt16();
+ m_nXOffset = m_pObjStrm->QuickReadInt32();
+ m_nYOffset = m_pObjStrm->QuickReadInt32();
+ m_objRubyMarker.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+LwpRubyMarker* LwpRubyLayout::GetMarker()
+{
+ return static_cast<LwpRubyMarker*>(m_objRubyMarker.obj(VO_RUBYMARKER).get());
+}
+
+LwpStory* LwpRubyLayout::GetContentStory()
+{
+ return static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
+}
+
+void LwpRubyLayout::ConvertContentText()
+{
+ LwpStory* pStory = GetContentStory();
+ LwpRubyMarker* pMarker = GetMarker();
+ if (pStory && pMarker)
+ pMarker->SetRubyText(pStory->GetContentText(true));
+}
+
+void LwpRubyLayout::RegisterStyle()
+{
+ LwpRubyMarker* pMarker = GetMarker();
+ if (!pMarker)
+ throw std::runtime_error("missing Ruby Marker");
+
+ std::unique_ptr<XFRubyStyle> xRubyStyle(new XFRubyStyle);
+
+ enumXFRubyPosition eType = enumXFRubyLeft;
+ if (m_nAlignment == LEFT)
+ {
+ eType = enumXFRubyLeft;
+ }
+ else if(m_nAlignment == RIGHT)
+ {
+ eType = enumXFRubyRight;
+ }
+ else if(m_nAlignment == CENTER)
+ {
+ eType = enumXFRubyCenter;
+ }
+ xRubyStyle->SetAlignment(eType);
+
+ eType = enumXFRubyTop;
+ if (m_nPlacement == TOP)
+ {
+ eType = enumXFRubyTop;
+ }
+ else if(m_nPlacement == BOTTOM)
+ {
+ eType = enumXFRubyBottom;
+ }
+ xRubyStyle->SetPosition(eType);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ OUString rubyStyle = pXFStyleManager->AddStyle(std::move(xRubyStyle)).m_pStyle->GetStyleName();
+ pMarker->SetRubyStyleName(rubyStyle);
+
+ LwpStory* pStory = GetContentStory();
+ pStory->SetFoundry(m_pFoundry);
+ OUString textStyle = pStory->RegisterFirstFribStyle();
+ pMarker->SetTextStyleName(textStyle);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpframelayout.hxx b/lotuswordpro/source/filter/lwpframelayout.hxx
new file mode 100644
index 000000000..af07c5c22
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpframelayout.hxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * the class for VO_FrameLayout
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRAMELAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRAMELAYOUT_HXX
+
+#include <memory>
+#include "lwplayout.hxx"
+#include "lwpstory.hxx"
+#include "lwpmarker.hxx"
+#include <xfilter/xfframestyle.hxx>
+#include <xfilter/xfframe.hxx>
+
+/**
+ * @brief For register frame style and parse frame
+ *
+ */
+
+class LwpFrame
+{
+public:
+ explicit LwpFrame(LwpPlacableLayout* pLayout);
+ ~LwpFrame();
+ void RegisterStyle(std::unique_ptr<XFFrameStyle>& rFrameStyle);
+ void Parse(XFFrame* pXFFrame, sal_Int32 nPageNo);
+ void XFConvert(XFContentContainer* pCont);
+private:
+ void ApplyWrapType(XFFrameStyle* pFrameStyle);
+ void ApplyMargins(XFFrameStyle* pFrameStyle);
+ void ApplyPadding(XFFrameStyle* pFrameStyle);
+ void ApplyBorders(XFFrameStyle* pFrameStyle);
+ void ApplyColumns(XFFrameStyle* pFrameStyle);
+ void ApplyShadow(XFFrameStyle* pFrameStyle);
+ void ApplyBackColor(XFFrameStyle* pFrameStyle);
+ void ApplyProtect(XFFrameStyle* pFrameStyle);
+ void ApplyTextDir(XFFrameStyle* pFrameStyle);
+ void ApplyPosType(XFFrameStyle* pFrameStyle);
+ void ApplyWatermark(XFFrameStyle* pFrameStyle);
+ void ApplyPatternFill(XFFrameStyle* pFrameStyle);
+ void ApplyBackGround(XFFrameStyle* pFrameStyle);
+ void ParseAnchorType(XFFrame* pXFFrame);
+ bool IsLeftWider();
+private:
+ LwpPlacableLayout* m_pLayout;
+ OUString m_StyleName;
+};
+
+/**
+ * @brief Frame link information
+ *
+ */
+class LwpFrameLink
+{
+public:
+ LwpFrameLink();
+ ~LwpFrameLink();
+ void Read(LwpObjectStream* pStrm);
+ LwpObjectID& GetNextLayout(){ return m_NextLayout;}
+ LwpObjectID& GetPreviousLayout(){ return m_PreviousLayout;}
+private:
+ LwpObjectID m_PreviousLayout;
+ LwpObjectID m_NextLayout;
+};
+
+/**
+ * @brief VO_FRAMELAYOUT object
+ *
+ */
+class LwpFrameLayout: public LwpPlacableLayout
+{
+public:
+ LwpFrameLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFrameLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_FRAME_LAYOUT;}
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ void XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart = 0, sal_Int32 nEnd = 0, bool bAll = false) override;
+ OUString GetNextLinkName();
+ bool HasPreviousLinkLayout();
+ bool IsForWaterMark() override;
+ double GetWidth() override;
+ void ApplyGraphicSize(XFFrame* pXFFrame);
+protected:
+ void Read() override;
+private:
+ double GetMaxWidth();
+
+private:
+ LwpFrameLink m_Link;
+ std::unique_ptr<LwpFrame> m_pFrame;
+ bool m_bGettingMaxWidth;
+};
+
+/**
+ * @brief VO_GROUPLAYOUT object , information for frame group layout
+ *
+ */
+class LwpGroupLayout: public LwpPlacableLayout
+{
+public:
+ LwpGroupLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpGroupLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_GROUP_LAYOUT;}
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ void XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart = 0, sal_Int32 nEnd = 0, bool bAll = false) override;
+protected:
+ void Read() override;
+private:
+ std::unique_ptr<LwpFrame> m_pFrame;
+
+};
+
+/**
+ * @brief VO_GROUPFRAME object , information for frame group contents
+ *
+ */
+class LwpGroupFrame: public LwpContent
+{
+public:
+ LwpGroupFrame(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpGroupFrame() override;
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+protected:
+ void Read() override;
+};
+
+class LwpStory;
+class LwpFoundry;
+class LwpDropcapLayout : public LwpFrameLayout
+{
+public:
+ LwpDropcapLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_DROPCAP_LAYOUT;}
+ virtual void Parse(IXFStream* pOutputStream) override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ sal_uInt16 GetLines() const {return m_nLines;}
+ void SetChars(sal_uInt32 nChars){ m_nChars += nChars;}
+ sal_uInt32 GetChars() const {return m_nChars;}
+ void RegisterStyle(LwpFoundry* pFoundry);
+ void RegisterStyle() override;
+protected:
+ void Read() override;
+private:
+ sal_uInt16 m_nLines;
+ sal_uInt32 m_nChars;
+};
+
+class LwpRubyLayout : public LwpFrameLayout
+{
+public:
+ LwpRubyLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ LwpRubyMarker* GetMarker();
+ void ConvertContentText();
+ LwpStory* GetContentStory();
+ void RegisterStyle() override;
+ enum{
+ LEFT = 4,
+ RIGHT = 5,
+ CENTER = 2,
+ TOP = 1,
+ BOTTOM = 3
+ };
+protected:
+ void Read() override;
+private:
+ sal_uInt8 m_nPlacement;
+ sal_uInt8 m_nAlignment;
+ sal_uInt16 m_nStateFlag;
+ sal_Int32 m_nXOffset;
+ sal_Int32 m_nYOffset;
+ LwpObjectID m_objRubyMarker;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
new file mode 100644
index 000000000..37684d7d7
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -0,0 +1,468 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+#include <lwpfrib.hxx>
+#include "lwpcharsetmgr.hxx"
+#include "lwpsection.hxx"
+#include "lwphyperlinkmgr.hxx"
+#include <xfilter/xfhyperlink.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfsection.hxx>
+#include <xfilter/xfsectionstyle.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include "lwpfribheader.hxx"
+#include "lwpfribtext.hxx"
+#include "lwpfribtable.hxx"
+#include "lwpfribbreaks.hxx"
+#include "lwpfribframe.hxx"
+#include "lwpfribsection.hxx"
+#include "lwpcharacterstyle.hxx"
+#include "lwpfootnote.hxx"
+#include "lwpnotes.hxx"
+#include "lwpfribmark.hxx"
+#include <lwpchangemgr.hxx>
+#include <lwpdocdata.hxx>
+#include <lwpglobalmgr.hxx>
+
+#include <osl/diagnose.h>
+
+
+LwpFrib::LwpFrib(LwpPara* pPara)
+ : m_pFribMap(nullptr)
+ , m_pPara(pPara)
+ , m_pNext(nullptr)
+ , m_nFribType(0)
+ , m_ModFlag(false)
+ , m_nRevisionType(0)
+ , m_bRevisionFlag(false)
+ , m_nEditor(0)
+{
+}
+
+LwpFrib::~LwpFrib()
+{
+ Deregister();
+}
+
+LwpFrib* LwpFrib::CreateFrib(LwpPara* pPara, LwpObjectStream* pObjStrm, sal_uInt8 fribtag,sal_uInt8 editID)
+{
+ //Read Modifier
+ std::unique_ptr<ModifierInfo> xModInfo;
+ if(fribtag & FRIB_TAG_MODIFIER)
+ {
+ xModInfo.reset(new ModifierInfo);
+ xModInfo->CodePage = 0;
+ xModInfo->FontID = 0;
+ xModInfo->RevisionType = 0;
+ xModInfo->RevisionFlag = false;
+ xModInfo->HasCharStyle = false;
+ xModInfo->HasLangOverride = false;
+ xModInfo->HasHighlight = false;
+ ReadModifiers(pObjStrm, xModInfo.get());
+ }
+
+ //Read frib data
+ std::unique_ptr<LwpFrib> newFrib;
+ sal_uInt16 friblen = pObjStrm->QuickReaduInt16();
+ sal_uInt8 fribtype = fribtag&~FRIB_TAG_TYPEMASK;
+ switch(fribtype)
+ {
+ case FRIB_TAG_INVALID: //fall through
+ case FRIB_TAG_EOP: //fall through
+ default:
+ newFrib.reset(new LwpFrib(pPara));
+ break;
+ case FRIB_TAG_TEXT:
+ {
+ newFrib.reset(new LwpFribText(pPara, (fribtag & FRIB_TAG_NOUNICODE) != 0));
+ break;
+ }
+ case FRIB_TAG_TABLE:
+ newFrib.reset(new LwpFribTable(pPara));
+ break;
+ case FRIB_TAG_TAB:
+ newFrib.reset(new LwpFribTab(pPara));
+ break;
+ case FRIB_TAG_PAGEBREAK:
+ newFrib.reset(new LwpFribPageBreak(pPara));
+ break;
+ case FRIB_TAG_FRAME:
+ newFrib.reset(new LwpFribFrame(pPara));
+ break;
+ case FRIB_TAG_FOOTNOTE:
+ newFrib.reset(new LwpFribFootnote(pPara));
+ break;
+ case FRIB_TAG_COLBREAK:
+ newFrib.reset(new LwpFribColumnBreak(pPara));
+ break;
+ case FRIB_TAG_LINEBREAK:
+ newFrib.reset(new LwpFribLineBreak(pPara));
+ break;
+ case FRIB_TAG_HARDSPACE:
+ newFrib.reset(new LwpFribHardSpace(pPara));
+ break;
+ case FRIB_TAG_SOFTHYPHEN:
+ newFrib.reset(new LwpFribSoftHyphen(pPara));
+ break;
+ case FRIB_TAG_PARANUMBER:
+ newFrib.reset(new LwpFribParaNumber(pPara));
+ break;
+ case FRIB_TAG_UNICODE: //fall through
+ case FRIB_TAG_UNICODE2: //fall through
+ case FRIB_TAG_UNICODE3: //fall through
+ newFrib.reset(new LwpFribUnicode(pPara));
+ break;
+ case FRIB_TAG_NOTE:
+ newFrib.reset(new LwpFribNote(pPara));
+ break;
+ case FRIB_TAG_SECTION:
+ newFrib.reset(new LwpFribSection(pPara));
+ break;
+ case FRIB_TAG_PAGENUMBER:
+ newFrib.reset(new LwpFribPageNumber(pPara));
+ break;
+ case FRIB_TAG_DOCVAR:
+ newFrib.reset(new LwpFribDocVar(pPara));
+ break;
+ case FRIB_TAG_BOOKMARK:
+ newFrib.reset(new LwpFribBookMark(pPara));
+ break;
+ case FRIB_TAG_FIELD:
+ newFrib.reset(new LwpFribField(pPara));
+ break;
+ case FRIB_TAG_CHBLOCK:
+ newFrib.reset(new LwpFribCHBlock(pPara));
+ break;
+ case FRIB_TAG_RUBYMARKER:
+ newFrib.reset(new LwpFribRubyMarker(pPara));
+ break;
+ case FRIB_TAG_RUBYFRAME:
+ newFrib.reset(new LwpFribRubyFrame(pPara));
+ break;
+ }
+
+ //Do not know why the fribTag judgement is necessary, to be checked with
+ if (fribtag & FRIB_TAG_MODIFIER)
+ {
+ newFrib->SetModifiers(xModInfo.release());
+ }
+
+ newFrib->m_nFribType = fribtype;
+ newFrib->m_nEditor = editID;
+ newFrib->Read(pObjStrm, friblen);
+ return newFrib.release();
+}
+
+void LwpFrib::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
+{
+ pObjStrm->SeekRel(len);
+}
+
+void LwpFrib::SetModifiers(ModifierInfo* pModifiers)
+{
+ if (pModifiers)
+ {
+ m_pModifiers.reset( pModifiers );
+ m_ModFlag = true;
+ if (pModifiers->RevisionFlag)
+ {
+ m_bRevisionFlag = true;
+ m_nRevisionType = pModifiers->RevisionType;
+ }
+ }
+}
+
+void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
+{
+ if (!m_pModifiers)
+ return;
+ if (!m_pModifiers->FontID && !m_pModifiers->HasCharStyle && !m_pModifiers->HasHighlight)
+ {
+ m_ModFlag = false;
+ return;
+ }
+ //we only read four modifiers, in these modifiers,CodePage and LangOverride are not styles,
+ //so we can only handle fontid and charstyle, if others, we should not reg style
+ //note by ,1-27
+ rtl::Reference<XFFont> pFont;
+ XFTextStyle* pStyle = nullptr;
+ m_StyleName.clear();
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFTextStyle* pNamedStyle = nullptr;
+ if (m_pModifiers->HasCharStyle && pFoundry)
+ {
+ pNamedStyle = dynamic_cast<XFTextStyle*>
+ (pFoundry->GetStyleManager()->GetStyle(m_pModifiers->CharStyleID));
+ }
+ if (pNamedStyle)
+ {
+ LwpCharacterStyle* pCharStyle = nullptr;
+ if (m_pModifiers->FontID && pFoundry)
+ pCharStyle = dynamic_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
+ if (pCharStyle)
+ {
+ std::unique_ptr<XFTextStyle> pNewStyle(new XFTextStyle());
+ *pNewStyle = *pNamedStyle;
+
+ pNewStyle->SetStyleName("");
+ pFont = pFoundry->GetFontManger().CreateOverrideFont(pCharStyle->GetFinalFontID(),m_pModifiers->FontID);
+ pNewStyle->SetFont(pFont);
+ IXFStyleRet aNewStyle = pXFStyleManager->AddStyle(std::move(pNewStyle));
+ m_StyleName = aNewStyle.m_pStyle->GetStyleName();
+ pStyle = dynamic_cast<XFTextStyle*>(aNewStyle.m_pStyle);
+ if (aNewStyle.m_bOrigDeleted)
+ pStyle = nullptr;
+ }
+ else
+ m_StyleName = pNamedStyle->GetStyleName();
+ }
+ else
+ {
+ if (m_pModifiers->FontID && pFoundry)
+ {
+ std::unique_ptr<XFTextStyle> pNewStyle(new XFTextStyle());
+ pFont = pFoundry->GetFontManger().CreateFont(m_pModifiers->FontID);
+ pNewStyle->SetFont(pFont);
+ IXFStyleRet aNewStyle = pXFStyleManager->AddStyle(std::move(pNewStyle));
+ m_StyleName = aNewStyle.m_pStyle->GetStyleName();
+ pStyle = dynamic_cast<XFTextStyle*>(aNewStyle.m_pStyle);
+ if (aNewStyle.m_bOrigDeleted)
+ pStyle = nullptr;
+ }
+ }
+
+ if (!m_pModifiers->HasHighlight)
+ return;
+
+ XFColor aColor = GetHighlightColor();//right yellow
+ if (pStyle)//change the style directly
+ pStyle->GetFont()->SetBackColor(aColor);
+ else //register a new style
+ {
+ std::unique_ptr<XFTextStyle> pNewStyle(new XFTextStyle());
+
+ if (!m_StyleName.isEmpty())
+ {
+ XFTextStyle* pOldStyle = pXFStyleManager->FindTextStyle(m_StyleName);
+ *pNewStyle = *pOldStyle;
+ pNewStyle->GetFont()->SetBackColor(aColor);
+ }
+ else
+ {
+ pFont = new XFFont;
+ pFont->SetBackColor(aColor);
+ pNewStyle->SetFont(pFont);
+ }
+ m_StyleName = pXFStyleManager->AddStyle(std::move(pNewStyle)).m_pStyle->GetStyleName();
+ }
+}
+
+void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
+{
+ for(;;)
+ {
+ bool bFailure;
+
+ // Get the modifier type
+ sal_uInt8 Modifier = pObjStrm->QuickReaduInt8(&bFailure);
+ if (bFailure)
+ break;
+
+ // Stop when we hit the last modifier
+ if (Modifier == FRIB_MTAG_NONE)
+ break;
+
+ // Get the modifier length
+ sal_uInt8 len = pObjStrm->QuickReaduInt8(&bFailure);
+ if (bFailure)
+ break;
+
+ switch (Modifier)
+ {
+ case FRIB_MTAG_FONT:
+ if (len != sizeof(pModInfo->FontID))
+ {
+ OSL_FAIL("FRIB_MTAG_FONT entry wrong size");
+ pObjStrm->SeekRel(len);
+ }
+ else
+ pModInfo->FontID = pObjStrm->QuickReaduInt32();
+ break;
+ case FRIB_MTAG_CHARSTYLE:
+ pModInfo->HasCharStyle = true;
+ pModInfo->CharStyleID.ReadIndexed(pObjStrm);
+ break;
+ case FRIB_MTAG_LANGUAGE:
+ pModInfo->HasLangOverride = true;
+ pModInfo->Language.Read(pObjStrm);
+ break;
+ case FRIB_MTAG_CODEPAGE:
+ if (len != sizeof(pModInfo->CodePage))
+ {
+ OSL_FAIL("FRIB_MTAG_CODEPAGE entry wrong size");
+ pObjStrm->SeekRel(len);
+ }
+ else
+ pModInfo->CodePage = pObjStrm->QuickReaduInt16();
+ break;
+ case FRIB_MTAG_ATTRIBUTE:
+ pModInfo->aTxtAttrOverride.Read(pObjStrm);
+ if (pModInfo->aTxtAttrOverride.IsHighlight())
+ pModInfo->HasHighlight = true;
+ break;
+ case FRIB_MTAG_REVISION:
+ pModInfo->RevisionType = pObjStrm->QuickReaduInt8();
+ pModInfo->RevisionFlag = true;
+ break;
+ default:
+ pObjStrm->SeekRel(len);
+ break;
+ }
+ // TODO: read the modifier data
+ }
+}
+
+/**
+* @descr: Whether there are other fribs following current frib.
+* @return: True if having following fribs, or false.
+*/
+bool LwpFrib::HasNextFrib()
+{
+ return GetNext() && GetNext()->GetType() != FRIB_TAG_EOP;
+}
+
+void LwpFrib::ConvertChars(XFContentContainer* pXFPara,const OUString& text)
+{
+ if (m_ModFlag)
+ {
+ OUString strStyleName = GetStyleName();
+ XFTextSpan *pSpan = new XFTextSpan(text,strStyleName);
+ pXFPara->Add(pSpan);
+ }
+ else
+ {
+ XFTextContent *pSpan = new XFTextContent();
+ pSpan->SetText(text);
+ pXFPara->Add(pSpan);
+ }
+}
+
+void LwpFrib::ConvertHyperLink(XFContentContainer* pXFPara, const LwpHyperlinkMgr* pHyperlink,const OUString& text)
+{
+ XFHyperlink* pHyper = new XFHyperlink;
+ pHyper->SetHRef(pHyperlink->GetHyperlink());
+ pHyper->SetText(text);
+ pHyper->SetStyleName(GetStyleName());
+ pXFPara->Add(pHyper);
+}
+
+/**
+* @descr: Get the current frib font style
+* @return: XFFont pointer
+*/
+rtl::Reference<XFFont> LwpFrib::GetFont()
+{
+ rtl::Reference<XFFont> pFont;
+ if(m_pModifiers&&m_pModifiers->FontID)
+ {
+ LwpFoundry* pFoundry = m_pPara->GetFoundry();
+ if (pFoundry)
+ pFont = pFoundry->GetFontManger().CreateFont(m_pModifiers->FontID);
+ }
+ else
+ {
+ XFParaStyle* pXFParaStyle = m_pPara->GetXFParaStyle();
+ pFont = pXFParaStyle->GetFont();
+ }
+ return pFont;
+}
+
+OUString LwpFrib::GetEditor()
+{
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ return pGlobal->GetEditorName(m_nEditor);
+}
+
+XFColor LwpFrib::GetHighlightColor()
+{
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ return pGlobal->GetHighlightColor(m_nEditor);
+}
+
+void LwpFrib::Register(std::map<LwpFrib*,OUString>* pFribMap)
+{
+ if (m_pFribMap)
+ throw std::runtime_error("registered already");
+ m_pFribMap = pFribMap;
+}
+
+void LwpFrib::Deregister()
+{
+ if (m_pFribMap)
+ {
+ m_pFribMap->erase(this);
+ m_pFribMap = nullptr;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribbreaks.cxx b/lotuswordpro/source/filter/lwpfribbreaks.cxx
new file mode 100644
index 000000000..cf9801275
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribbreaks.cxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpfribbreaks.hxx"
+#include "lwpfribheader.hxx"
+#include "lwpstory.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfsectionstyle.hxx>
+#include "lwpsection.hxx"
+#include <xfilter/xfsection.hxx>
+#include <lwpglobalmgr.hxx>
+
+void LwpFribColumnBreak::RegisterBreakStyle(LwpPara * pPara)
+{
+// XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(pFoundry->GetStyleManager()->GetStyle(styleID));
+ XFParaStyle* pBaseStyle = pPara->GetXFParaStyle();
+ if (pBaseStyle == nullptr) return;
+// m_StyleName = pBaseStyle->GetStyleName();
+
+ std::unique_ptr<XFParaStyle> pOverStyle( new XFParaStyle );
+ *pOverStyle = *pBaseStyle;
+ pOverStyle->SetStyleName("");
+
+ //New code
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPara->GetStoryID().obj().get());
+ LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
+ if( pCurLayout && (pCurLayout->GetNumCols() == 1) )
+
+ {
+// if (!GetNext() || GetNext()->GetType()==FRIB_TAG_EOP)
+ pOverStyle->SetBreaks(enumXFBreakBefPage);
+// else
+// pOverStyle->SetBreaks(enumXFBreakBefPage);
+ }
+ else
+ {
+ if (!GetNext() || GetNext()->GetType()==FRIB_TAG_EOP)
+ pOverStyle->SetBreaks(enumXFBreakAftColumn);
+ else
+ pOverStyle->SetBreaks(enumXFBreakBefColumn);
+ }
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(pOverStyle)).m_pStyle->GetStyleName();
+}
+
+LwpFribPageBreak::LwpFribPageBreak( LwpPara* pPara )
+ : LwpFrib(pPara), m_bLastFrib(false)
+{
+}
+
+LwpFribPageBreak::~LwpFribPageBreak()
+{
+}
+
+void LwpFribPageBreak::Read(LwpObjectStream * pObjStrm, sal_uInt16 /*len*/)
+{
+ m_Layout.ReadIndexed(pObjStrm);
+}
+
+void LwpFribPageBreak::RegisterBreakStyle(LwpPara* pPara)
+{
+ XFParaStyle* pBaseStyle = pPara->GetXFParaStyle();
+ if (pBaseStyle == nullptr) return;
+
+ LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(m_Layout.obj().get());
+ if(pLayout)
+ {
+ m_pMasterPage.reset( new LwpMasterPage(pPara, pLayout) );
+ m_pMasterPage->RegisterMasterPage(this);
+ return;
+ }
+
+ std::unique_ptr<XFParaStyle> pOverStyle(new XFParaStyle);
+ *pOverStyle = *pBaseStyle;
+ pOverStyle->SetStyleName("");
+ pOverStyle->SetMasterPage(pBaseStyle->GetMasterPage());
+
+ if (!GetNext() || GetNext()->GetType()==FRIB_TAG_EOP)
+ m_bLastFrib = true;
+ else
+ m_bLastFrib = false;
+
+ if (m_bLastFrib)
+ pOverStyle->SetBreaks(enumXFBreakAftPage);
+ else
+ pOverStyle->SetBreaks(enumXFBreakBefPage);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(pOverStyle)).m_pStyle->GetStyleName();
+}
+
+void LwpFribPageBreak::ParseLayout()
+{
+ if(m_pMasterPage)
+ {
+ m_pMasterPage->ParseSection(this);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribbreaks.hxx b/lotuswordpro/source/filter/lwpfribbreaks.hxx
new file mode 100644
index 000000000..e54ffbf6a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribbreaks.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBBREAKS_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBBREAKS_HXX
+
+#include <lwpfrib.hxx>
+#include "lwppara.hxx"
+#include "lwpfribsection.hxx"
+
+class LwpFribPageBreak: public LwpFrib
+{
+public:
+ explicit LwpFribPageBreak( LwpPara* pPara );
+ virtual ~LwpFribPageBreak() override;
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ void RegisterBreakStyle(LwpPara* pPara);
+ void ParseLayout();
+ LwpObjectID& GetLayout() { return m_Layout;}
+ bool IsLastFrib() const {return m_bLastFrib;}
+
+private:
+ LwpObjectID m_Layout;
+ bool m_bLastFrib;
+
+ std::unique_ptr<LwpMasterPage> m_pMasterPage;
+};
+
+class LwpFribLineBreak: public LwpFrib
+{
+public:
+ explicit LwpFribLineBreak( LwpPara* pPara ) : LwpFrib(pPara){}
+};
+
+class LwpFribColumnBreak: public LwpFrib
+{
+public:
+ explicit LwpFribColumnBreak( LwpPara* pPara ) : LwpFrib(pPara){}
+ void RegisterBreakStyle(LwpPara* pPara);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx
new file mode 100644
index 000000000..8a94efb8c
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -0,0 +1,245 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - footnote
+ */
+
+#include "lwpfribframe.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include <lwpglobalmgr.hxx>
+#include <xfilter/xfchange.hxx>
+/**
+ * @short: Read frame frib
+ */
+void LwpFribFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objLayout.ReadIndexed(pObjStrm);
+}
+
+/**
+* @descr: Get the layout object which the frib points to
+*
+*/
+rtl::Reference<LwpObject> LwpFribFrame::GetLayout() const
+{
+ return m_objLayout.obj();
+}
+
+/**
+* @descr: register frame style
+* @param: pFoundry - current foundry pointer
+*
+*/
+void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
+{
+ rtl::Reference<LwpObject> pObject = m_objLayout.obj();
+
+ if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
+ {
+ LwpDropcapLayout *pLayout = dynamic_cast<LwpDropcapLayout*>(pObject.get());
+ if (!pLayout)
+ return;
+ pLayout->RegisterStyle(pFoundry);
+ }
+ else
+ {
+ //register frame style
+ LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject.get());
+ if (!pLayout)
+ return;
+ pLayout->SetFoundry(pFoundry);
+ pLayout->DoRegisterStyle();
+
+ //register next frib text style
+ sal_uInt8 nType = pLayout->GetRelativeType();
+ if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
+ && HasNextFrib())
+ {
+ XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
+ if (pOldStyle->GetMasterPage().isEmpty())
+ m_StyleName = pOldStyle->GetStyleName();
+ else
+ {
+ std::unique_ptr<XFParaStyle> pParaStyle(new XFParaStyle);
+ *pParaStyle = *pOldStyle;
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(pParaStyle)).m_pStyle->GetStyleName();
+ }
+ }
+ //remember the current paragraph font size which will be used in parsing frame
+ pLayout->SetFont(GetFont());
+ }
+}
+void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
+{
+ rtl::Reference<LwpObject> pObject = m_objLayout.obj();
+
+ if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
+ {
+ pPara->SetParaDropcap(true);
+ pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject.get()));
+ }
+ else
+ pPara->SetParaDropcap(false);
+}
+
+/**
+* @descr: convert frame
+*
+*/
+void LwpFribFrame::XFConvert(XFContentContainer* pCont)
+{
+ XFContentContainer* pXFContentContainer = pCont;
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout().get());
+ if (!pLayout)
+ return;
+ sal_uInt8 nType = pLayout->GetRelativeType();
+ if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
+ {
+ rtl::Reference<LwpVirtualLayout> xContainerLayout(pLayout->GetContainerLayout());
+ if (xContainerLayout.is() && xContainerLayout->IsFrame())
+ {
+ //same page as text and in frame
+ pXFContentContainer = m_pPara->GetXFContainer();
+ }
+ else if (xContainerLayout.is() && xContainerLayout->IsCell())
+ {
+ //same page as text and in cell, get the first xfpara
+ rtl::Reference<XFContent> first(
+ pCont->FindFirstContent(enumXFContentPara));
+ XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
+ if(pXFFirtPara)
+ pXFContentContainer = pXFFirtPara;
+ }
+ }
+ OUString sChangeID;
+ if(m_bRevisionFlag)
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ sChangeID = pChangeMgr->GetChangeID(this);
+ if (!sChangeID.isEmpty())
+ {
+ XFChangeStart* pChangeStart = new XFChangeStart;
+ pChangeStart->SetChangeID(sChangeID);
+ pXFContentContainer->Add(pChangeStart);
+ }
+ }
+
+ pLayout->DoXFConvert(pXFContentContainer);
+
+ if(m_bRevisionFlag)
+ {
+ if (!sChangeID.isEmpty())
+ {
+ XFChangeEnd* pChangeEnd = new XFChangeEnd;
+ pChangeEnd->SetChangeID(sChangeID);
+ pXFContentContainer->Add(pChangeEnd);
+ }
+ }
+
+ if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
+ && HasNextFrib())
+ {
+ XFParagraph* pXFPara = new XFParagraph();
+ pXFPara->SetStyleName(m_StyleName);
+ m_pPara->AddXFContent(pXFPara);
+ m_pPara->GetFribs().SetXFPara(pXFPara);
+ }
+
+}
+
+/**
+ * @descr: Read Ruby frame
+ *
+ */
+void LwpFribRubyFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objLayout.ReadIndexed(pObjStrm);
+}
+/**
+ * @descr: Register Ruby frame style
+ *
+ */
+void LwpFribRubyFrame::RegisterStyle(LwpFoundry* pFoundry)
+{
+ LwpRubyLayout* pLayout = GetLayout();
+ if (pLayout)
+ {
+ pLayout->SetFoundry(pFoundry);
+ pLayout->RegisterStyle();
+ }
+}
+/**
+ * @descr: convert Ruby frame
+ *
+ */
+void LwpFribRubyFrame::XFConvert()
+{
+ LwpRubyLayout* pLayout = GetLayout();
+ if (pLayout)
+ {
+ pLayout->ConvertContentText();
+ }
+}
+
+LwpRubyLayout* LwpFribRubyFrame::GetLayout()
+{
+ return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj().get());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribframe.hxx b/lotuswordpro/source/filter/lwpfribframe.hxx
new file mode 100644
index 000000000..e1834644a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribframe.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - footnote
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBFRAME_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBFRAME_HXX
+
+#include <lwpfrib.hxx>
+#include "lwppara.hxx"
+#include "lwpframelayout.hxx"
+
+class LwpFribFrame : public LwpFrib
+{
+public:
+ explicit LwpFribFrame( LwpPara* pPara) : LwpFrib(pPara){}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ rtl::Reference<LwpObject> GetLayout() const;
+ void RegisterStyle(LwpFoundry* pFoundry) override;
+ void SetParaDropcap(LwpPara* pPara);
+ void XFConvert(XFContentContainer* pCont);
+private:
+ LwpObjectID m_objLayout;
+};
+
+class LwpFribRubyFrame : public LwpFrib
+{
+public:
+ explicit LwpFribRubyFrame(LwpPara* pPara) : LwpFrib(pPara){}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ LwpRubyLayout* GetLayout();
+ void RegisterStyle(LwpFoundry* pFoundry) override;
+ void XFConvert();
+private:
+ LwpObjectID m_objLayout;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribheader.hxx b/lotuswordpro/source/filter/lwpfribheader.hxx
new file mode 100644
index 000000000..9740b047d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribheader.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBHEADER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBHEADER_HXX
+
+#define FRIB_TAG_NOUNICODE 0x40 // Don't translate text to/from Unicode
+#define FRIB_TAG_MODIFIER 0x80 // This frib has a modifier on it
+#define FRIB_TAG_TYPEMASK (FRIB_TAG_NOUNICODE | FRIB_TAG_MODIFIER)
+
+#define FRIB_TAG_ELVIS 0 // "EOP dammit" tag
+
+#define FRIB_MTAG_NONE 0
+#define FRIB_MTAG_FONT 1
+#define FRIB_MTAG_REVISION 2
+#define FRIB_MTAG_CHARSTYLE 3
+#define FRIB_MTAG_ATTRIBUTE 4
+#define FRIB_MTAG_LANGUAGE 5
+#define FRIB_MTAG_CODEPAGE 8
+
+#define FT_MAXIMUM 30
+
+/* Registration definitions */
+enum
+{
+ FS_RIGHTSIDE = 0x00,
+ FS_LEFTSIDE = 0x10
+};
+/* Mode definitions */
+enum
+{
+ FS_REGISTERSELF = 0x20,
+ FS_READING = 0x40
+};
+
+enum
+{
+ FRIB_TAG_INVALID, // FT_INVALID
+ FRIB_TAG_EOP, // FT_EOP
+ FRIB_TAG_TEXT, // FT_TEXT
+ FRIB_TAG_TABLE, // FT_TABLE
+ FRIB_TAG_TAB, // FT_TAB
+ FRIB_TAG_PAGEBREAK, // FT_PAGEBREAK
+ FRIB_TAG_FRAME, // FT_FRAME
+ FRIB_TAG_FOOTNOTE, // FT_FOOTNOTE
+ FRIB_TAG_COLBREAK, // FT_COLBREAK
+ FRIB_TAG_LINEBREAK, // FT_LINEBREAK
+ FRIB_TAG_HARDSPACE, // FT_HARDSPACE
+ FRIB_TAG_SOFTHYPHEN, // FT_SOFTHYPHEN
+ FRIB_TAG_PARANUMBER, // FT_PARANUMBER
+ FRIB_TAG_UNICODE, // FT_UNICODE
+ FRIB_TAG_UNICODE2, // FT_UNICODE
+ FRIB_TAG_UNICODE3, // FT_UNICODE
+ FRIB_TAG_SEPARATOR, // FT_SEPARATOR
+ FRIB_TAG_SECTION, // FT_SECTION
+ FRIB_TAG_TOMBSTONE, // FT_TOMBSTONE
+ FRIB_TAG_SPECIALTAB, // FT_SPECIALTAB
+ FRIB_TAG_PAGENUMBER, // FT_PAGENUMBER
+ FRIB_TAG_NOTE, // FT_NOTE
+ FRIB_TAG_DOCVAR, // FT_DOCVAR
+ FRIB_TAG_BOOKMARK, // FT_BOOKMARK
+ FRIB_TAG_DDE, // FT_DDE
+ FRIB_TAG_FIELD, // FT_FIELD
+ FRIB_TAG_CHBLOCK, // FT_CHBLOCK
+ FRIB_TAG_FLOWBREAK, // FT_FLOWBREAK
+ FRIB_TAG_RUBYMARKER, // FT_RUBYMARKER
+ FRIB_TAG_RUBYFRAME // FT_RUBYFRAME
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
new file mode 100644
index 000000000..9ee9fb9c3
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -0,0 +1,1430 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpfribmark.hxx"
+#include <lwptools.hxx>
+#include <lwpglobalmgr.hxx>
+#include "lwpdoc.hxx"
+#include "lwpdivinfo.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xfbookmark.hxx>
+#include <xfilter/xfentry.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/xfcrossref.hxx>
+#include <xfilter/xfdocfield.hxx>
+#include <xfilter/xfdatestyle.hxx>
+#include <xfilter/xftimestyle.hxx>
+#include <xfilter/xfdate.hxx>
+#include <xfilter/xfruby.hxx>
+#include <lwpchangemgr.hxx>
+#include <xfilter/xfchange.hxx>
+
+/**
+ * @short: Read hyperlink frib and Click here block
+ */
+void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objMarker.ReadIndexed(pObjStrm);
+ m_nType = pObjStrm->QuickReaduInt8();
+}
+
+void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
+{
+ sal_uInt8 type = GetType();
+ if (!pStory)
+ return;
+ LwpCHBlkMarker* pMarker = dynamic_cast<LwpCHBlkMarker*>(m_objMarker.obj().get());
+
+ if (!pMarker)
+ return;
+ sal_uInt16 nAction = pMarker->GetAction();
+ if (nAction == LwpCHBlkMarker::CLICKHERE_CHBEHAVIORINTERNETLINK)//hyperlink
+ {
+ LwpHyperlinkMgr* pHyperlink = pStory->GetHyperlinkMgr();
+ if (type == MARKER_START)
+ {
+ if (pHyperlink)
+ {
+ pHyperlink->SetHyperlinkFlag(true);
+ pHyperlink->SetHyperlink(pMarker->GetNamedProperty("URL"));
+ }
+ }
+ else if (type == MARKER_END)//or none
+ {
+ pHyperlink->SetHyperlinkFlag(false);
+ }
+ }
+ else//click here block
+ {
+ pMarker->ConvertCHBlock(pXFPara,type);
+ }
+}
+/**
+ * @short: register bookmark frib
+ */
+void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
+{
+ OUString name;
+ LwpBookMark* pBook = pFoundry ? pFoundry->GetBookMark(GetMarkerID()) : nullptr;
+ if (pBook)
+ name = pBook->GetName();
+
+ OUString sDivision;
+ LwpDocument* pDoc = pFoundry ? pFoundry->GetDocument() : nullptr;
+ if (pDoc)
+ {
+ LwpObjectID& rID = pDoc->GetDivInfoID();
+ if (!rID.IsNull())
+ {
+ LwpDivInfo *pDivInvo = dynamic_cast<LwpDivInfo*>(rID.obj(VO_DIVISIONINFO).get());
+ if (pDivInvo)
+ sDivision = pDivInvo->GetDivName();
+ }
+ }
+
+ sal_uInt8 type = GetType();
+
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpBookmarkMgr* pMarkMgr = pGlobal->GetLwpBookmarkMgr();
+ if (type == MARKER_START)
+ {
+ rtl::Reference<XFBookmarkStart> xMarkStart(new XFBookmarkStart);
+ xMarkStart->SetDivision(sDivision);
+ xMarkStart->SetName(name);
+ pMarkMgr->AddXFBookmarkStart(name, xMarkStart.get());//add to map
+ m_xStart = xMarkStart;
+ }
+ else if(type == MARKER_END)
+ {
+ rtl::Reference<XFBookmarkEnd> xMarkEnd(new XFBookmarkEnd);
+ xMarkEnd->SetDivision(sDivision);
+ xMarkEnd->SetName(name);
+ pMarkMgr->AddXFBookmarkEnd(name, xMarkEnd.get()); //add to map
+ m_xEnd = xMarkEnd;
+ }
+}
+
+LwpFribBookMark::LwpFribBookMark(LwpPara* pPara )
+ : LwpFrib(pPara)
+ , m_nType(0)
+{
+}
+
+/**
+ * @short: Read bookmark frib
+ */
+void LwpFribBookMark::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objMarker.ReadIndexed(pObjStrm);
+ m_nType = pObjStrm->QuickReaduInt8();
+}
+/**
+ * @short: convert bookmark frib
+ */
+void LwpFribBookMark::XFConvert(XFContentContainer* pXFPara)
+{
+ sal_uInt8 type = GetType();
+
+ if (type == MARKER_START && m_xStart)
+ {
+ pXFPara->Add(m_xStart.get());
+ }
+ else if(type == MARKER_END && m_xEnd)
+ {
+ pXFPara->Add(m_xEnd.get());
+ }
+}
+
+/**
+ * @short: Read index entry frib
+ */
+LwpFribField::LwpFribField( LwpPara* pPara )
+ : LwpFrib(pPara)
+ , m_nType(0)
+ , m_TimeStyle("")
+ , m_nSubType(0)
+ , m_sFormula("")
+ , m_nCrossRefType(0)
+ , m_nDateTimeType(0)
+ , m_nDocPowerType(0)
+{
+}
+
+void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objMarker.ReadIndexed(pObjStrm);
+ m_nType = pObjStrm->QuickReaduInt8();
+}
+
+LwpFieldMark* LwpFribField::GetMarker()
+{
+ return dynamic_cast<LwpFieldMark*>(m_objMarker.obj().get());
+}
+
+void LwpFribField::XFConvert(XFContentContainer* pXFPara)
+{
+ LwpFieldMark* pFieldMark = GetMarker();
+ if (!pFieldMark)
+ return;
+
+ sal_uInt8 type = GetType();
+ sal_uInt16 fieldType = pFieldMark->GetFieldType();
+
+ OUString sChangeID;
+ if(pFieldMark->GetRevisionFlag())
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ sChangeID = pChangeMgr->GetChangeID(pFieldMark->GetStartFrib());
+ }
+
+ CheckFieldType(pFieldMark);
+ //end marker
+ if (type == MARKER_END)
+ {
+ if (!pFieldMark->GetStart())
+ return;
+ if (pFieldMark->IsFormulaInsert())
+ {
+ XFTextContent *pSpan = new XFTextContent();
+ pSpan->SetText(">");
+ pXFPara->Add(pSpan);
+ }
+ if (fieldType == LwpFieldMark::FLD_FIELD)
+ {
+ if (m_nSubType == SUBFIELD_DATETIME)
+ {
+ ConvertDateTimeEnd(pXFPara,pFieldMark);
+ }
+ else if (m_nSubType == SUBFIELD_CROSSREF)
+ {
+ ConvertCrossRefEnd(pXFPara,pFieldMark);
+ }
+ else if (m_nSubType == SUBFIELD_DOCPOWER)
+ {
+ ConvertDocFieldEnd(pXFPara,pFieldMark);
+ }
+ }
+ if(pFieldMark->GetRevisionFlag() && !sChangeID.isEmpty())
+ {
+ XFChangeEnd* pChangeEnd = new XFChangeEnd;
+ pChangeEnd->SetChangeID(sChangeID);
+ pXFPara->Add(pChangeEnd);
+ }
+
+ return;
+ }
+
+ //start marker
+ if(pFieldMark->GetRevisionFlag() && !sChangeID.isEmpty())
+ {
+ XFChangeStart* pChangeStart = new XFChangeStart;
+ pChangeStart->SetChangeID(sChangeID);
+ pXFPara->Add(pChangeStart);
+ }
+
+ if (fieldType == LwpFieldMark::FLD_INDEX)
+ {
+ OUString sKey1,sKey2;
+ pFieldMark->ParseIndex(sKey1,sKey2);
+ if (!sKey1.isEmpty())
+ {
+ XFEntry* pEntry = new XFEntry;
+ pEntry->SetEntryType(enumXFEntryAlphabetical);
+ pEntry->SetKey(sKey1,sKey2);
+ pXFPara->Add(pEntry);
+ }
+ }
+ else if (fieldType == LwpFieldMark::FLD_TOC)
+ {
+ OUString sLevel,sText;
+ pFieldMark->ParseTOC(sLevel,sText);
+ if (!sLevel.isEmpty() && !sText.isEmpty())
+ {
+ XFEntry* pEntry = new XFEntry;
+ pEntry->SetEntryType(enumXFEntryTOC);
+ pEntry->SetStringValue(sText);
+ pEntry->SetOutlineLevel(sLevel.toInt32());
+ pXFPara->Add(pEntry);
+ }
+ }
+ else if (fieldType == LwpFieldMark::FLD_FIELD)
+ {
+ sal_uInt8 nDatetype;
+ OUString sFormula;
+ /*sal_Bool bIsDateTime =*/ pFieldMark->IsDateTimeField(nDatetype,sFormula);
+
+ if (m_nSubType == SUBFIELD_DATETIME)//date time
+ {
+ ConvertDateTimeStart(pXFPara,pFieldMark);
+ }
+ else if (m_nSubType == SUBFIELD_CROSSREF)//cross ref
+ {
+ ConvertCrossRefStart(pXFPara,pFieldMark);
+ }
+ else if (m_nSubType == SUBFIELD_DOCPOWER)
+ {
+ ConvertDocFieldStart(pXFPara,pFieldMark);
+ }
+ }
+
+ if (pFieldMark->IsFormulaInsert())
+ {
+ XFTextContent *pSpan = new XFTextContent();
+ pSpan->SetText("<");
+ pXFPara->Add(pSpan);
+ }
+
+ pFieldMark->SetStart(true);
+}
+
+void LwpFribField::RegisterStyle(LwpFoundry* pFoundry)
+{
+ LwpFrib::RegisterStyle(pFoundry);
+ LwpFieldMark* pFieldMark = GetMarker();
+ if (!pFieldMark)
+ return;
+
+ sal_uInt8 type = GetType();
+ sal_uInt16 fieldType = pFieldMark->GetFieldType();
+
+ if (type == MARKER_START && fieldType == LwpFieldMark::FLD_FIELD)
+ {
+ RegisterTimeField(pFieldMark);
+ }
+
+ if (type == MARKER_START && m_bRevisionFlag)
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ pChangeMgr->AddChangeFrib(this);
+ pFieldMark->SetStartFrib(this);
+ pFieldMark->SetRevisionFlag(true);
+ }
+}
+
+void LwpFribField::RegisterTimeField(const LwpFieldMark* pFieldMark)
+{
+ OUString sFormula = pFieldMark->GetFormula();//now bookmark maybe not all register to bookmarkmgr,
+ if (sFormula == "TotalEditingTime")//so check field type now is not correct.
+ RegisterTotalTimeStyle();
+ else
+ {
+ sal_Int32 index = sFormula.indexOf(0x20); //space
+ if (index < 0)
+ return;
+
+ OUString tag = sFormula.copy(0,index);
+ if (tag == "Now()" || tag == "CreateDate" || tag == "EditDate")
+ RegisterDateTimeStyle(sFormula.copy(index+1));
+ }
+}
+
+void LwpFribField::RegisterTotalTimeStyle()
+{
+ std::unique_ptr<XFTimeStyle> pTimeStyle(new XFTimeStyle);//use the default format
+ pTimeStyle->SetTruncate(false);
+ pTimeStyle->AddMinute();
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_TimeStyle = pXFStyleManager->AddStyle(std::move(pTimeStyle)).m_pStyle->GetStyleName();
+}
+
+void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula)
+{
+ std::unique_ptr<XFDateStyle> pDateStyle;
+ std::unique_ptr<XFTimeStyle> pTimeStyle;
+//DATE
+ if (sFormula.getLength()<2)
+ return;
+ if (sFormula[1] == 'F')
+ {
+ if (sFormula == "%FLSystemShortDate")
+ {
+ pDateStyle = LwpTools::GetSystemDateStyle(false);
+ }
+ else if (sFormula == "%FLSystemLongDate")
+ {
+ pDateStyle = LwpTools::GetSystemDateStyle(true);
+ }
+ else if (sFormula == "%FLISODate1" || sFormula == "%FLYYYY/MM/DD" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay();
+ }
+ else if (sFormula == "%FLISODate2" || sFormula == "%FLYYYY/MM/DD HH:mm:SS" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddHour();
+ pDateStyle->AddText(":");
+ pDateStyle->AddMinute();
+ pDateStyle->AddText(":");
+ pDateStyle->AddSecond();
+ }
+ else if (sFormula == "%FLM/D/YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLMonth D, YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLWeekday, Month D, YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLMn D, YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLWday, Mn D, YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLMn D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%FLWeekday, Mn D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%FLMn D, YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLM/D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%FLM/YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLMn YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLWeekday")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ }
+ else if (sFormula == "%FLWday")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay(false);
+ }
+ else if (sFormula == "%FLMonth")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(true,true);
+ }
+ else if (sFormula == "%FLMn")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false,true);
+ }
+ else if (sFormula == "%FLD")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%FLM")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ }
+ else if (sFormula == "%FLYYYY" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear(false);
+ }
+ //chinese version begin
+ else if (sFormula == "%FLYY/M/D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear(false);
+ pDateStyle->AddText("-");
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("-");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if(sFormula == "%FLYYYY Month D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if(sFormula == "%FLWeekday, YYYY Month D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(",");
+ pDateStyle->AddYear();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if(sFormula == "%FLYYYY Mn D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if(sFormula == "%FLWday, YYYY Mn D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay(false);
+ pDateStyle->AddText(",");
+ pDateStyle->AddYear();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ //next 2 are the same with english version
+ else if (sFormula == "%FLYY Mn D")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%FLYY/M")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("-");
+ pDateStyle->AddMonth(false);
+ }
+ else if (sFormula == "%FLYY Mn")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ }
+ else if (sFormula == "%FLeeeeoa" || sFormula == "%FLffffooaa" || sFormula == "%FLEEEEOA")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ OUString sText;
+ pDateStyle->AddYear();
+ sText = OUString(u'\x5e74');
+ pDateStyle->AddText(sText);
+ pDateStyle->AddMonth(false);
+ sText = OUString(u'\x6708');
+ pDateStyle->AddText(sText);
+ pDateStyle->AddMonthDay(false);
+ sText = OUString(u'\x65e5');
+ pDateStyle->AddText(sText);
+ }
+ else if (sFormula == "%FLoa" || sFormula == "%FLooaa" || sFormula == "%FLOA" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ OUString sText;
+ pDateStyle->AddMonth(false);
+ sText = OUString(u'\x6708');
+ pDateStyle->AddText(sText);
+ pDateStyle->AddMonthDay(false);
+ sText = OUString(u'\x65e5');
+ pDateStyle->AddText(sText);
+ }
+ else if (sFormula == "%FLYYYY/M/D" || sFormula == "%FLGGGG/od/ad")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ pDateStyle->AddText("-");
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("-");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%FLYY.M.D" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear(false);
+ pDateStyle->AddText(".");
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText(".");
+ pDateStyle->AddMonthDay(false);
+ }
+ //chinese version end
+ //other version begin
+ else if (sFormula == "%FLWeekday, Month DD, YYYY" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLYYYY/MM/DD" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLD/M/YY" )
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLD Month YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLDD Month YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLWeekday, D Month YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLWeekday, DD Month YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLD Mn YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLWday, D Mn YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLWday, DD Mn YYYY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%FLD Mn")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ }
+ else if (sFormula == "%FLDD Mn")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ }
+ else if (sFormula == "%FLWeekday, D Mn")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ }
+ else if (sFormula == "%FLWeekday, DD Mn")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ }
+ else if (sFormula == "%FLD Mn YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLDD Mn YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(false,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLD/M")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth(false);
+ }
+ else if (sFormula == "%FLDD/MM")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth();
+ }
+ else if(sFormula == "%FLDD/MM/YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth();
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear(false);
+ }
+ else if (sFormula == "%FLMM/YY")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth();
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear(false);
+ }
+ //other version end
+ //TIME
+ else if (sFormula == "%FLSystemTime")
+ {
+ pTimeStyle = LwpTools::GetSystemTimeStyle();
+ }
+ else if (sFormula == "%FLISOTime1" || sFormula == "%FLH:mm:SS")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddSecond();
+ }
+ else if (sFormula == "%FLH:mm ampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(" ");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%FLH:mm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ }
+ else if (sFormula == "%FLH:mm:SS ampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddSecond();
+ pTimeStyle->AddText(" ");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%FLH:mm:SS")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddSecond();
+ }
+ else if (sFormula == "%FLH ampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ pTimeStyle->AddText(" ");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%FLH")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ }
+ else if (sFormula == "%FLmm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddMinute();
+ }
+ else if (sFormula == "%FLSS")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddSecond();
+ }
+ else if (sFormula == "%FLampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->SetAmPm(true);
+ }
+ //chinese version begin
+ else if (sFormula == "%FLjF" || sFormula == "%FLJFF"
+ || sFormula == "%FLjjF" || sFormula == "%FLJJFF " )
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ OUString sText;
+ sText = OUString(u'\x70b9');
+ pTimeStyle->AddText(sText);
+ pTimeStyle->AddMinute(false);
+ sText = OUString(u'\x5206');
+ pTimeStyle->AddText(sText);
+ }
+ else if (sFormula == "%FLjjjF" || sFormula == "%FLJJJFF" )
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->SetAmPm(true);
+ pTimeStyle->AddHour(false);
+ OUString sText;
+ sText = OUString(u'\x70b9');
+ pTimeStyle->AddText(sText);
+ pTimeStyle->AddMinute(false);
+ sText = OUString(u'\x5206');
+ pTimeStyle->AddText(sText);
+ }
+ //chinese version end
+ //other version begin
+ else if (sFormula == "%FLHH:mm ampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(" ");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%FLHH ampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(" ");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%FLHH:mm:SS ampm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddSecond();
+ pTimeStyle->AddText(" ");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%FLHH:mm")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ }
+ else if (sFormula == "%FLHH:mm:SS")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddSecond();
+ }
+ //other version end
+ }
+ else if(sFormula[1] == 'D')
+ {
+ if (sFormula == "%Da")
+ {
+ pDateStyle = LwpTools::GetSystemDateStyle(false);
+ }
+ else if (sFormula == "%DB" || sFormula == "%Db")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%Dc" || sFormula == "%DC")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%Dd" || sFormula == "%DD")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(", ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(", ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%DE" || sFormula == "%De")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%Df" || sFormula == "%DF")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddWeekDay();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%Dg")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%Dh")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%Di" || sFormula == "%DI")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(".");
+ pDateStyle->AddMonth(true,true);
+ }
+ else if (sFormula == "%Dj" || sFormula == "%DJ")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay(false);
+ pDateStyle->AddText(".");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%Dk" || sFormula == "%DK")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddYear();
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(" ");
+ pDateStyle->AddMonthDay(false);
+ }
+ else if (sFormula == "%DL" || sFormula == "%Dl")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonth(true,true);
+ pDateStyle->AddText(",");
+ pDateStyle->AddYear();
+ }
+ else if (sFormula == "%Dm")
+ {
+ pDateStyle.reset(new XFDateStyle);
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonth();
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear();
+ }
+ }
+ else if (sFormula[1] == 'T')
+ {
+ if (sFormula == "%T1")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ }
+ else if (sFormula == "%T2" || sFormula == "%T6"
+ || sFormula == "%T4" || sFormula == "%T8" )
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour(false);
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->SetAmPm(true);
+ }
+ else if (sFormula == "%T3" || sFormula == "%T7"
+ || sFormula == "%T5" || sFormula == "%T9")
+ {
+ pTimeStyle.reset(new XFTimeStyle);
+ pTimeStyle->AddHour();
+ pTimeStyle->AddText(":");
+ pTimeStyle->AddMinute();
+ pTimeStyle->AddText(":");
+ pTimeStyle->SetAmPm(true);
+ }
+ }
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ if (pDateStyle)
+ m_TimeStyle = pXFStyleManager->AddStyle(std::move(pDateStyle)).m_pStyle->GetStyleName();
+ if (pTimeStyle)
+ m_TimeStyle = pXFStyleManager->AddStyle(std::move(pTimeStyle)).m_pStyle->GetStyleName();
+}
+
+void LwpFribField::CheckFieldType(LwpFieldMark* pFieldMark)
+{
+ sal_uInt8 nType;
+ OUString sFormula;
+ if (pFieldMark->IsDateTimeField(nType,sFormula))
+ {
+ m_nDateTimeType = nType;
+ m_sFormula = sFormula;
+ m_nSubType = SUBFIELD_DATETIME;
+ }
+ else if (pFieldMark->IsCrossRefField(nType,sFormula))
+ {
+ m_nCrossRefType = nType;
+ m_sFormula = sFormula;
+ m_nSubType = SUBFIELD_CROSSREF;
+ }
+ else if (pFieldMark->IsDocPowerField(nType,sFormula))
+ {
+ m_nDocPowerType = nType;
+ m_nSubType = SUBFIELD_DOCPOWER;
+ }
+ else
+ {
+ m_nSubType = SUBFIELD_INVALID;
+ }
+}
+
+void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
+{
+ XFContent* pContent = nullptr;
+ switch(m_nDocPowerType)
+ {
+ case LwpFieldMark::DOC_DESCRIPTION:
+ {
+ pContent = new XFDescriptionStart;
+ break;
+ }
+ case LwpFieldMark::DOC_NUMPAGES:
+ {
+ pContent = new XFPageCountStart;
+ break;
+ }
+ case LwpFieldMark::DOC_NUMWORDS:
+ {
+ pContent = new XFWordCountStart;
+ break;
+ }
+ case LwpFieldMark::DOC_NUMCHARS:
+ {
+ pContent = new XFCharCountStart;
+ break;
+ }
+ }
+ if (!pContent)
+ return;
+
+ if (m_ModFlag)//(m_pModifiers)
+ {
+ XFTextSpanStart* pSpan = new XFTextSpanStart;
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ pFieldMark->SetStyleFlag(true);
+ }
+ else
+ pXFPara->Add(pContent);
+}
+
+void LwpFribField::ConvertDocFieldEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
+{
+ XFContent* pContent = nullptr;
+ switch(m_nDocPowerType)
+ {
+ case LwpFieldMark::DOC_DESCRIPTION:
+ {
+ pContent = new XFDescriptionEnd;
+ break;
+ }
+ case LwpFieldMark::DOC_NUMPAGES:
+ {
+ pContent = new XFPageCountEnd;
+ break;
+ }
+ case LwpFieldMark::DOC_NUMWORDS:
+ {
+ pContent = new XFWordCountEnd;
+ break;
+ }
+ case LwpFieldMark::DOC_NUMCHARS:
+ {
+ pContent = new XFCharCountEnd;
+ break;
+ }
+ }
+ if (pContent)
+ {
+ if (pFieldMark->GetStyleFlag())
+ {
+ XFTextSpanEnd* pSpan = new XFTextSpanEnd;
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ }
+ else
+ pXFPara->Add(pContent);
+ }
+}
+
+void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
+{
+ XFContent* pContent = nullptr;
+ switch(m_nDateTimeType)
+ {
+ case LwpFieldMark::DATETIME_NOW:
+ {
+ pContent = new XFDateStart;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ case LwpFieldMark::DATETIME_CREATE:
+ {
+ pContent = new XFCreateTimeStart;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ case LwpFieldMark::DATETIME_LASTEDIT:
+ {
+ pContent = new XFLastEditTimeStart;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ case LwpFieldMark::DATETIME_TOTALTIME:
+ {
+ pContent = new XFTotalEditTimeStart;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ default:
+ break;
+ }
+ if (!pContent)
+ return;
+
+ if (m_ModFlag)
+ {
+ XFTextSpanStart* pSpan = new XFTextSpanStart;
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ pFieldMark->SetStyleFlag(true);
+ }
+ else
+ pXFPara->Add(pContent);
+
+}
+
+void LwpFribField::ConvertDateTimeEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
+{
+ XFContent* pContent = nullptr;
+ switch(m_nDateTimeType)
+ {
+ case LwpFieldMark::DATETIME_NOW:
+ {
+ pContent = new XFDateEnd;
+ break;
+ }
+ case LwpFieldMark::DATETIME_CREATE:
+ {
+ pContent = new XFCreateTimeEnd;
+ break;
+ }
+ case LwpFieldMark::DATETIME_LASTEDIT:
+ {
+ pContent = new XFLastEditTimeEnd;
+ break;
+ }
+ case LwpFieldMark::DATETIME_TOTALTIME:
+ {
+ pContent = new XFTotalEditTimeEnd;
+ break;
+ }
+ }
+ if (pContent)
+ {
+ if (pFieldMark->GetStyleFlag())
+ {
+ XFTextSpanEnd* pSpan = new XFTextSpanEnd;
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ }
+ else
+ pXFPara->Add(pContent);
+ }
+}
+
+void LwpFribField::ConvertCrossRefStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
+{
+ XFCrossRefStart* pRef = new XFCrossRefStart;
+ pRef->SetRefType(m_nCrossRefType);
+ pRef->SetMarkName(m_sFormula);
+// pFieldMark->SetStart(sal_True);//for some unusual cases
+ if (m_ModFlag)
+ {
+ XFTextSpanStart* pSpan = new XFTextSpanStart;
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pRef);
+ pXFPara->Add(pSpan);
+ pFieldMark->SetStyleFlag(true);
+ }
+ else
+ pXFPara->Add(pRef);
+}
+
+void LwpFribField::ConvertCrossRefEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
+{
+ XFCrossRefEnd* pRef = new XFCrossRefEnd;
+ if (pFieldMark->GetStyleFlag())
+ {
+ XFTextSpanEnd* pSpan = new XFTextSpanEnd;
+ pSpan->Add(pRef);
+ pXFPara->Add(pSpan);
+ }
+ else
+ pXFPara->Add(pRef);
+}
+
+LwpFribRubyMarker::LwpFribRubyMarker( LwpPara* pPara )
+ : LwpFrib(pPara)
+ , m_nType(0)
+{
+}
+
+void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objMarker.ReadIndexed(pObjStrm);
+ m_nType = pObjStrm->QuickReaduInt8();
+}
+
+void LwpFribRubyMarker::XFConvert(XFContentContainer* pXFPara)
+{
+ sal_uInt8 type = GetType();
+ LwpRubyMarker* pMarker = dynamic_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER).get());
+
+ if (type == MARKER_START)
+ {
+ XFRubyStart* pRubyStart = new XFRubyStart;
+ if (pMarker)
+ {
+ pRubyStart->SetStyleName(pMarker->GetRubyStyleName());
+ }
+ pXFPara->Add(pRubyStart);
+ }
+ else if(type == MARKER_END)
+ {
+ XFRubyEnd* pRubyEnd = new XFRubyEnd;
+ if (pMarker)
+ {
+ pRubyEnd->SetText(pMarker->GetRubyText());
+ pRubyEnd->SetStyleName(pMarker->GetTextStyleName());
+ }
+ pXFPara->Add(pRubyEnd);
+ }
+}
+
+void LwpFribRubyMarker::RegisterStyle(LwpFoundry* /*pFoundry*/)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribmark.hxx b/lotuswordpro/source/filter/lwpfribmark.hxx
new file mode 100644
index 000000000..0f47b204a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribmark.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBMARK_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBMARK_HXX
+
+#include <lwpfrib.hxx>
+#include "lwpstory.hxx"
+#include "lwpmarker.hxx"
+#include <xfilter/xfbookmark.hxx>
+
+class LwpFribCHBlock : public LwpFrib
+{
+public:
+ explicit LwpFribCHBlock( LwpPara* pPara )
+ : LwpFrib(pPara)
+ , m_nType(0)
+ {}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ enum{MARKER_START=1,MARKER_END,MARKER_NONE};
+ void XFConvert(XFContentContainer* pXFPara,LwpStory* pStory);
+private:
+ sal_uInt8 m_nType;
+ LwpObjectID m_objMarker;
+};
+
+class LwpFribBookMark : public LwpFrib
+{
+public:
+ explicit LwpFribBookMark( LwpPara* pPara );
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ const LwpObjectID& GetMarkerID() const {return m_objMarker;}
+ sal_uInt8 GetType() const {return m_nType;}
+ enum{MARKER_START=1,MARKER_END,MARKER_NONE};
+ void XFConvert(XFContentContainer* pXFPara);
+ void RegisterStyle(LwpFoundry* pFoundry) override;
+private:
+ sal_uInt8 m_nType;
+ LwpObjectID m_objMarker;
+ rtl::Reference<XFBookmarkStart> m_xStart;
+ rtl::Reference<XFBookmarkEnd> m_xEnd;
+};
+
+class LwpFribField : public LwpFrib
+{
+public:
+ explicit LwpFribField( LwpPara* pPara );
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ LwpFieldMark* GetMarker();
+ sal_uInt8 GetType() const {return m_nType;}
+ enum{MARKER_START=1,MARKER_END,MARKER_NONE};
+ void XFConvert(XFContentContainer* pXFPara);
+ void RegisterStyle(LwpFoundry* pFoundry) override;
+ enum{
+ SUBFIELD_INVALID = 0,
+ SUBFIELD_DATETIME = 1,
+ SUBFIELD_CROSSREF = 2,
+ SUBFIELD_DOCPOWER = 3,
+ };
+private:
+ sal_uInt8 m_nType;
+ LwpObjectID m_objMarker;
+ OUString m_TimeStyle;
+
+ sal_uInt8 m_nSubType;//datetime/crossref/other
+ OUString m_sFormula;
+
+ sal_uInt8 m_nCrossRefType;
+ sal_uInt8 m_nDateTimeType;
+ sal_uInt8 m_nDocPowerType;
+
+ void RegisterTimeField(const LwpFieldMark* pFieldMark);
+ void RegisterDateTimeStyle(const OUString& sFormula);
+ void RegisterTotalTimeStyle();
+ void CheckFieldType(LwpFieldMark* pFieldMark);
+ void ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
+ void ConvertDocFieldEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark);
+ void ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
+ void ConvertDateTimeEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark);
+ static void ConvertCrossRefEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark);
+ void ConvertCrossRefStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
+};
+
+class LwpFribRubyMarker : public LwpFrib
+{
+public:
+ explicit LwpFribRubyMarker( LwpPara* pPara );
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ enum{MARKER_START=1,MARKER_END,MARKER_NONE};
+ void XFConvert(XFContentContainer* pXFPara);
+ void RegisterStyle(LwpFoundry* pFoundry) override;
+private:
+ sal_uInt8 m_nType;
+ LwpObjectID m_objMarker;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribptr.cxx b/lotuswordpro/source/filter/lwpfribptr.cxx
new file mode 100644
index 000000000..f41f5b0e7
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribptr.cxx
@@ -0,0 +1,600 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpfribptr.hxx"
+
+#include "lwpfribheader.hxx"
+#include "lwpfribtext.hxx"
+#include "lwppara.hxx"
+#include "lwpstory.hxx"
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/xftabstop.hxx>
+#include <xfilter/xflinebreak.hxx>
+#include "lwpfribsection.hxx"
+#include "lwpsection.hxx"
+#include "lwpfribbreaks.hxx"
+#include "lwpfribframe.hxx"
+#include "lwpfribtable.hxx"
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include "lwphyperlinkmgr.hxx"
+#include <xfilter/xfhyperlink.hxx>
+#include "lwpfootnote.hxx"
+#include "lwpnotes.hxx"
+#include "lwpfribmark.hxx"
+#include <xfilter/xfchange.hxx>
+#include <lwpchangemgr.hxx>
+#include <lwpglobalmgr.hxx>
+#include <lwpdropcapmgr.hxx>
+
+LwpFribPtr::LwpFribPtr()
+ : m_pFribs(nullptr),m_pXFPara(nullptr),m_pPara(nullptr)
+{
+}
+
+LwpFribPtr::~LwpFribPtr()
+{
+ for (LwpFrib* pCurFrib = m_pFribs; pCurFrib;)
+ {
+ LwpFrib* pNextFrib = pCurFrib -> GetNext();
+ delete pCurFrib;
+ pCurFrib = pNextFrib;
+ }
+}
+
+void LwpFribPtr::ReadPara(LwpObjectStream* pObjStrm)
+{
+ LwpFrib* pCurFrib = m_pFribs = nullptr;
+ for(;;)
+ {
+ // Get the frib type
+ sal_uInt8 FribTag = pObjStrm->QuickReaduInt8();
+
+ sal_uInt8 FribType = FribTag & ~FRIB_TAG_TYPEMASK;
+
+ // Stop when we hit Elvis
+ if (FribType == FRIB_TAG_ELVIS)
+ break;
+
+ // skip the editor ID
+ //pObjStrm->SeekRel(sizeof(sal_uInt8));
+ sal_uInt8 FribEditor = pObjStrm->QuickReaduInt8();
+ if( FribType != FT_MAXIMUM )
+ {
+ LwpFrib* pFrib = LwpFrib::CreateFrib( m_pPara, pObjStrm, FribTag,FribEditor);
+ if(!m_pFribs)
+ {
+ m_pFribs = pFrib;
+ }
+ if(pCurFrib)
+ {
+ pCurFrib->SetNext(pFrib);
+ }
+ else//first frib in the para
+ {
+ if (pFrib->GetType() == FRIB_TAG_TEXT)
+ {
+ LwpFribText* pText = static_cast<LwpFribText*>(pFrib);
+ if (pFrib->GetModifiers())
+ m_pPara->SetFirstFrib(pText->GetText(),pText->GetModifiers()->FontID);
+ else
+ m_pPara->SetFirstFrib(pText->GetText(),0);
+ }
+ }
+ pCurFrib = pFrib;
+ }
+ }
+}
+
+void LwpFribPtr::XFConvert()
+{
+ LwpFrib* pFrib = m_pFribs;
+ while(pFrib)
+ {
+ sal_uInt8 nFribType = pFrib->GetType();
+ bool bRevisionFlag = pFrib->GetRevisionFlag();
+ OUString sChangeID;
+ if (bRevisionFlag)
+ {
+ if ( nFribType!= FRIB_TAG_TABLE && nFribType != FRIB_TAG_FIELD
+ && nFribType != FRIB_TAG_FRAME)
+ {
+ //sal_uInt8 nRevisionType = pFrib->GetRevisionType();
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ sChangeID = pChangeMgr->GetChangeID(pFrib);
+ if (!sChangeID.isEmpty())
+ {
+ rtl::Reference<XFChangeStart> xChangeStart(new XFChangeStart);
+ xChangeStart->SetChangeID(sChangeID);
+ m_pXFPara->Add(xChangeStart.get());
+ }
+ }
+ }
+
+ switch(nFribType)
+ {
+ case FRIB_TAG_TEXT:
+ {
+ LwpFribText* textFrib= static_cast<LwpFribText*>(pFrib);
+ textFrib->XFConvert(m_pXFPara,m_pPara->GetStory());
+ }
+ break;
+ case FRIB_TAG_TAB:
+ {
+ LwpFribTab* tabFrib = static_cast<LwpFribTab*>(pFrib);
+ if (pFrib->m_ModFlag)
+ {
+ rtl::Reference<XFTextSpan> xSpan(new XFTextSpan);
+ xSpan->SetStyleName(tabFrib->GetStyleName());
+ rtl::Reference<XFTabStop> xTab(new XFTabStop);
+ xSpan->Add(xTab.get());
+ m_pXFPara->Add(xSpan.get());
+ }
+ else
+ {
+ rtl::Reference<XFTabStop> xTab(new XFTabStop);
+ m_pXFPara->Add(xTab.get());
+ }
+ break;
+ }
+ case FRIB_TAG_SECTION:
+ {
+ LwpFribSection* pSectionFrib = static_cast<LwpFribSection*>(pFrib);
+ pSectionFrib->ParseSection();
+ break;
+ }
+
+ case FRIB_TAG_PAGEBREAK:
+ {
+ LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
+ LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout().obj().get());
+ if(pLayout)
+ {
+ pPageBreak->ParseLayout();
+ }
+ else
+ {
+ if (pPageBreak->IsLastFrib())
+ {
+ m_pXFPara->SetStyleName( pPageBreak->GetStyleName() );
+ }
+ else
+ {
+ //parse pagebreak
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(pFrib->GetStyleName());
+ SetXFPara(xPara.get());
+ m_pPara->AddXFContent(xPara.get());
+ }
+ }
+ break;
+ }
+ case FRIB_TAG_COLBREAK:
+ {
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(pFrib->GetStyleName());
+ SetXFPara(xPara.get());
+ m_pPara->AddXFContent(xPara.get());
+ break;
+ }
+ case FRIB_TAG_LINEBREAK:
+ {
+ rtl::Reference<XFLineBreak> xLineBreak(new XFLineBreak);
+ m_pXFPara->Add(xLineBreak.get());
+ break;
+ }
+ case FRIB_TAG_UNICODE: //fall through
+ case FRIB_TAG_UNICODE2: //fall through
+ case FRIB_TAG_UNICODE3: //fall through
+ {
+ LwpFribUnicode* unicodeFrib= static_cast<LwpFribUnicode*>(pFrib);
+ unicodeFrib->XFConvert(m_pXFPara,m_pPara->GetStory());
+ }
+ break;
+ case FRIB_TAG_HARDSPACE:
+ {
+ OUString sHardSpace(u'\x00a0');
+ LwpStory *pStory = m_pPara->GetStory();
+ LwpHyperlinkMgr* pHyperlink = pStory ? pStory->GetHyperlinkMgr() : nullptr;
+ if (pHyperlink && pHyperlink->GetHyperlinkFlag())
+ pFrib->ConvertHyperLink(m_pXFPara,pHyperlink,sHardSpace);
+ else
+ pFrib->ConvertChars(m_pXFPara,sHardSpace);
+ }
+ break;
+ case FRIB_TAG_SOFTHYPHEN:
+ {
+ OUString sSoftHyphen(u'\x00ad');
+ pFrib->ConvertChars(m_pXFPara,sSoftHyphen);
+ }
+ break;
+ case FRIB_TAG_FRAME:
+ {
+ LwpFribFrame* frameFrib= static_cast<LwpFribFrame*>(pFrib);
+ rtl::Reference<LwpObject> pLayout = frameFrib->GetLayout();
+ if (pLayout.is() && pLayout->GetTag() == VO_DROPCAPLAYOUT)
+ {
+ LwpFoundry* pFoundry = m_pPara->GetFoundry();
+ LwpDropcapMgr* pMgr = pFoundry ? pFoundry->GetDropcapMgr() : nullptr;
+ if (pMgr)
+ pMgr->SetXFPara(m_pXFPara);
+ }
+ frameFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_CHBLOCK:
+ {
+ LwpFribCHBlock* chbFrib = static_cast<LwpFribCHBlock*>(pFrib);
+ chbFrib->XFConvert(m_pXFPara,m_pPara->GetStory());
+ }
+ break;
+ case FRIB_TAG_TABLE:
+ {
+ LwpFribTable* tableFrib = static_cast<LwpFribTable*>(pFrib);
+ //tableFrib->XFConvert(m_pPara->GetXFContainer());
+ tableFrib->XFConvert(m_pXFPara);
+ }
+ break;
+ case FRIB_TAG_BOOKMARK:
+ {
+ LwpFribBookMark* bookmarkFrib = static_cast<LwpFribBookMark*>(pFrib);
+ bookmarkFrib->XFConvert(m_pXFPara);
+ }
+ break;
+ case FRIB_TAG_FOOTNOTE:
+ {
+ LwpFribFootnote* pFootnoteFrib = static_cast<LwpFribFootnote*>(pFrib);
+ pFootnoteFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_FIELD:
+ {
+ LwpFribField* fieldFrib = static_cast<LwpFribField*>(pFrib);
+ fieldFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_NOTE:
+ {
+ LwpFribNote* pNoteFrib = static_cast<LwpFribNote*>(pFrib);
+ pNoteFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_PAGENUMBER:
+ {
+ LwpFribPageNumber* pagenumFrib = static_cast<LwpFribPageNumber*>(pFrib);
+ pagenumFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_DOCVAR:
+ {
+ LwpFribDocVar* docFrib = static_cast<LwpFribDocVar*>(pFrib);
+ docFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_RUBYMARKER:
+ {
+ LwpFribRubyMarker* rubyFrib = static_cast<LwpFribRubyMarker*>(pFrib);
+ rubyFrib->XFConvert(m_pXFPara);
+ break;
+ }
+ case FRIB_TAG_RUBYFRAME:
+ {
+ LwpFribRubyFrame* rubyfrmeFrib = static_cast<LwpFribRubyFrame*>(pFrib);
+ rubyfrmeFrib->XFConvert();
+ break;
+ }
+ default :
+ break;
+ }
+
+ if (bRevisionFlag )//&& pFrib->GetRevisionType() == LwpFrib::REV_INSERT)
+ {
+ if (nFribType!= FRIB_TAG_TABLE && nFribType != FRIB_TAG_FIELD
+ && nFribType != FRIB_TAG_FRAME)
+ {
+ if (!sChangeID.isEmpty())
+ {
+ rtl::Reference<XFChangeEnd> xChangeEnd(new XFChangeEnd);
+ xChangeEnd->SetChangeID(sChangeID);
+ m_pXFPara->Add(xChangeEnd.get());
+ }
+ }
+ }
+ pFrib = pFrib->GetNext();
+ }
+
+}
+
+/**************************************************************************
+ * @descr: Whether has a frib which type is nType
+**************************************************************************/
+LwpFrib* LwpFribPtr::HasFrib(sal_uInt8 nType)
+{
+ LwpFrib* pFrib = m_pFribs;
+ while(pFrib)
+ {
+ if(pFrib->GetType()==nType)
+ {
+ return pFrib;
+ }
+ pFrib = pFrib->GetNext();
+ }
+ return nullptr;
+}
+
+void LwpFribPtr::GatherAllText()
+{
+ LwpFrib* pFrib = m_pFribs;
+ while(pFrib)
+ {
+ switch(pFrib->GetType())
+ {
+ case FRIB_TAG_TEXT:
+ {
+ OUString sText = static_cast<LwpFribText*>(pFrib)->GetText();
+ m_pPara->SetAllText(sText);
+ break;
+ }
+ case FRIB_TAG_UNICODE: //fall through
+ case FRIB_TAG_UNICODE2: //fall through
+ case FRIB_TAG_UNICODE3: //fall through :
+ {
+ OUString sText = static_cast<LwpFribText*>(pFrib)->GetText();
+ m_pPara->SetAllText(sText);
+ break;
+ }
+ default :
+ break;
+ }
+ pFrib = pFrib->GetNext();
+ }
+}
+
+void LwpFribPtr::RegisterStyle()
+{
+ LwpFrib* pFrib = m_pFribs;
+ while(pFrib)
+ {
+ switch(pFrib->GetType())
+ {
+ case FRIB_TAG_TEXT:
+ {
+ pFrib->RegisterStyle(m_pPara->GetFoundry());
+ OUString sText = static_cast<LwpFribText*>(pFrib)->GetText();
+ ProcessDropcap(m_pPara->GetStory(), pFrib,sText.getLength());
+ break;
+ }
+ case FRIB_TAG_TAB:
+ pFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ case FRIB_TAG_SECTION:
+ {
+ //section registerstyle here;
+ LwpFribSection* pSectionFrib = static_cast<LwpFribSection*>(pFrib);
+ pSectionFrib->RegisterSectionStyle();
+ //for bullet
+ pSectionFrib->SetSectionName();
+ }
+ break;
+ case FRIB_TAG_PAGEBREAK:
+ {
+ LwpFribPageBreak* breakFrib = static_cast<LwpFribPageBreak*>(pFrib);
+ breakFrib->RegisterBreakStyle(m_pPara);
+ }
+ break;
+ case FRIB_TAG_COLBREAK:
+ {
+ LwpFribColumnBreak* breakFrib = static_cast<LwpFribColumnBreak*>(pFrib);
+ breakFrib->RegisterBreakStyle(m_pPara);
+ }
+ break;
+ case FRIB_TAG_UNICODE: //fall through
+ case FRIB_TAG_UNICODE2: //fall through
+ case FRIB_TAG_UNICODE3: //fall through :
+ {
+ pFrib->RegisterStyle(m_pPara->GetFoundry());
+ OUString sText = static_cast<LwpFribUnicode*>(pFrib)->GetText();
+ ProcessDropcap(m_pPara->GetStory(), pFrib,sText.getLength());
+ break;
+ }
+ case FRIB_TAG_HARDSPACE:
+ pFrib->RegisterStyle(m_pPara->GetFoundry());
+ ProcessDropcap(m_pPara->GetStory(),pFrib,1);
+ break;
+ case FRIB_TAG_SOFTHYPHEN:
+ pFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ case FRIB_TAG_FRAME:
+ {
+ LwpFribFrame* frameFrib = static_cast<LwpFribFrame*>(pFrib);
+ frameFrib->SetParaDropcap(m_pPara);
+ frameFrib->RegisterStyle(m_pPara->GetFoundry());
+ //register framelayout style, ,03/09/2005
+ //frameFrib->GetLayout()->RegisterStyle();
+ }
+ break;
+ case FRIB_TAG_CHBLOCK:
+ break;
+ case FRIB_TAG_TABLE:
+ {
+ LwpFribTable* tableFrib = static_cast<LwpFribTable*>(pFrib);
+ tableFrib->RegisterNewStyle();
+ }
+ break;
+ case FRIB_TAG_FOOTNOTE:
+ {
+ LwpFribFootnote* pFribFootnote = static_cast<LwpFribFootnote*>(pFrib);
+ pFribFootnote->RegisterNewStyle();
+ }
+ break;
+ case FRIB_TAG_NOTE:
+ {
+ LwpFribNote* pNoteFrib = static_cast<LwpFribNote*>(pFrib);
+ pNoteFrib->RegisterNewStyle();
+ break;
+ }
+ case FRIB_TAG_PAGENUMBER:
+ {
+ pFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ }
+ case FRIB_TAG_DOCVAR:
+ {
+ LwpFribDocVar* docFrib = static_cast<LwpFribDocVar*>(pFrib);
+ docFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ }
+ case FRIB_TAG_FIELD:
+ {
+ LwpFribField* fieldFrib = static_cast<LwpFribField*>(pFrib);
+ fieldFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ }
+ case FRIB_TAG_BOOKMARK:
+ {
+ LwpFribBookMark* bookmarkFrib = static_cast<LwpFribBookMark*>(pFrib);
+ bookmarkFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ }
+ case FRIB_TAG_RUBYFRAME:
+ {
+ LwpFribRubyFrame* rubyfrmeFrib = static_cast<LwpFribRubyFrame*>(pFrib);
+ rubyfrmeFrib->RegisterStyle(m_pPara->GetFoundry());
+ break;
+ }
+ default :
+ break;
+ }
+ if (pFrib->GetRevisionFlag() && pFrib->GetType()!= FRIB_TAG_FIELD)
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ pChangeMgr->AddChangeFrib(pFrib);
+ }
+
+ pFrib = pFrib->GetNext();
+ }
+}
+
+void LwpFribPtr::ProcessDropcap(LwpStory* pStory, const LwpFrib* pFrib,sal_uInt32 nLen)
+{
+ if (pStory && pStory->GetDropcapFlag())
+ {
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFTextStyle* pFribStyle = pXFStyleManager->FindTextStyle(pFrib->GetStyleName());
+ pFribStyle->GetFont()->SetFontSize(0);
+
+ LwpDropcapLayout* pObj = dynamic_cast<LwpDropcapLayout*>(pStory->GetLayoutsWithMe().GetOnlyLayout().obj().get());
+ if (pObj)
+ pObj->SetChars(nLen);
+ }
+}
+/**
+ * @descr: If the position of pPreLayout is earlier than pNextLayout, return true, or return false, default return true
+ *
+*/
+bool LwpFribPtr::ComparePagePosition(LwpVirtualLayout const * pPreLayout, LwpVirtualLayout const * pNextLayout)
+{
+ if(!pPreLayout || !pNextLayout)
+ return true;
+
+ LwpFrib* pFrib = m_pFribs;
+ LwpVirtualLayout* pLayout = nullptr;
+ while(pFrib)
+ {
+ switch(pFrib->GetType())
+ {
+ case FRIB_TAG_SECTION:
+ {
+ LwpFribSection* pSectionFrib = static_cast<LwpFribSection*>(pFrib);
+ LwpSection* pSection = pSectionFrib->GetSection();
+ if(pSection)
+ {
+ pLayout = pSection->GetPageLayout();
+ }
+
+ break;
+ }
+ case FRIB_TAG_PAGEBREAK:
+ {
+ LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pPageBreak->GetLayout().obj().get());
+ break;
+ }
+ default:
+ break;
+ }
+
+ if(pLayout)
+ {
+ if(pPreLayout == pLayout)
+ return true;
+ if(pNextLayout == pLayout)
+ return false;
+ }
+ pFrib = pFrib->GetNext();
+ }
+
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribptr.hxx b/lotuswordpro/source/filter/lwpfribptr.hxx
new file mode 100644
index 000000000..d59cb81ca
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribptr.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBPTR_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBPTR_HXX
+
+#include <lwpobjstrm.hxx>
+#include <lwpfrib.hxx>
+#include "lwpstory.hxx"
+#include <xfilter/xfparagraph.hxx>
+
+class LwpPara;
+class LwpFribPtr
+{
+public:
+ LwpFribPtr();
+ ~LwpFribPtr();
+ void ReadPara(LwpObjectStream* pObjStrm);
+private:
+ LwpFrib* m_pFribs;
+ XFParagraph* m_pXFPara;//Current XFPara used for frib parsing
+ LwpPara* m_pPara;//for get foundry
+ static void ProcessDropcap(LwpStory* pStory, const LwpFrib* pFrib,sal_uInt32 nLen);
+public:
+ void XFConvert();
+ void SetXFPara(XFParagraph* Para){m_pXFPara = Para;}
+ XFParagraph* GetXFPara(){return m_pXFPara;}
+ void SetPara(LwpPara* para){m_pPara=para;}
+ void RegisterStyle();
+ LwpFrib* GetFribs(){return m_pFribs;}
+ LwpFrib* HasFrib(sal_uInt8 nType);
+ bool ComparePagePosition(LwpVirtualLayout const * pPreLayout, LwpVirtualLayout const * pNextLayout);
+ void GatherAllText();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
new file mode 100644
index 000000000..a3ada1578
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -0,0 +1,454 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * the class for section frib and process section and page layout
+ ************************************************************************/
+
+#include "lwpfribsection.hxx"
+#include "lwpfribbreaks.hxx"
+#include "lwpstory.hxx"
+#include "lwpsection.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfsectionstyle.hxx>
+#include <xfilter/xfsection.hxx>
+#include <xfilter/xfindex.hxx>
+#include "lwpfribptr.hxx"
+#include <lwpglobalmgr.hxx>
+
+LwpFribSection::LwpFribSection(LwpPara *pPara)
+ : LwpFrib(pPara)
+{
+
+}
+
+LwpFribSection::~LwpFribSection()
+{
+}
+
+/**
+ * @descr: Read section frib information
+ *
+ */
+void LwpFribSection::Read(LwpObjectStream *pObjStrm, sal_uInt16 /*len*/)
+{
+ m_Section.ReadIndexed(pObjStrm);
+}
+
+/**
+ * @descr: Get section pointer
+ *
+ */
+LwpSection* LwpFribSection::GetSection()
+{
+ return dynamic_cast<LwpSection*>(m_Section.obj().get());
+}
+
+/**
+ * @descr: Register section style
+ *
+ */
+void LwpFribSection::RegisterSectionStyle()
+{
+ LwpPageLayout* pLayout = GetPageLayout();
+ if(pLayout)
+ {
+ m_pMasterPage.reset( new LwpMasterPage(m_pPara, pLayout) );
+ m_pMasterPage->RegisterMasterPage(this);
+ }
+}
+
+/**
+ * @descr: Register section style
+ *
+ */
+void LwpFribSection::SetSectionName()
+{
+ LwpSection* pSection = GetSection();
+ if (!pSection)
+ return;
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (!pStory)
+ return;
+ pStory->SetSectionName(pSection->GetSectionName());
+}
+
+/**
+ * @descr: Get page layout that current section points
+ *
+ */
+LwpPageLayout* LwpFribSection::GetPageLayout()
+{
+ if (LwpSection* pSection = GetSection())
+ return pSection->GetPageLayout();
+ return nullptr;
+}
+
+/**
+ * @descr: XFConvert section
+ *
+ */
+void LwpFribSection::ParseSection()
+{
+ LwpPageLayout* pLayout = GetPageLayout();
+ if(pLayout)
+ {
+ // StartWithinColume not support now
+ LwpLayout::UseWhenType eSectionType = pLayout->GetUseWhenType();
+ if(eSectionType==LwpLayout::StartWithinColume)
+ {
+ return;
+ }
+ if(m_pMasterPage)
+ {
+ m_pMasterPage->ParseSection(this);
+ }
+ }
+ else if (LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
+ {
+ rtl::Reference<LwpObject> xObj(m_Section.obj());
+ if (xObj.is() && xObj->GetTag() == VO_INDEXSECTION)
+ {
+ //create a new section and add it to container
+ XFIndex* pIndex = new XFIndex;
+ pIndex->SetIndexType(enumXFIndexAlphabetical);
+ SetDefaultAlphaIndex(pIndex);
+
+ pStory->AddXFContent( pIndex );
+ m_pPara->SetXFContainer( pIndex );
+ }
+ else
+ {
+ XFContentContainer* pContent = pStory->GetXFContent();
+ m_pPara->SetXFContainer( pContent );
+ }
+ }
+}
+
+void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
+{
+ LwpFoundry* pFoundry = m_pPara->GetFoundry();
+ OUString styleName = pFoundry->FindActuralStyleName("Separator");
+
+ LwpIndexSection* pIndexSection = dynamic_cast<LwpIndexSection*>(m_Section.obj().get());
+ XFIndexTemplate * pTemplateSep = new XFIndexTemplate();
+ if (pIndexSection && pIndexSection->IsFormatSeparator())
+ {
+ pXFIndex->SetSeparator(true);
+ pTemplateSep->AddEntry(enumXFIndexTemplateText,"");
+ }
+ //pXFIndex->AddTemplate("separator","Separator",pTemplateSep);
+ pXFIndex->AddTemplate("separator",styleName,pTemplateSep);
+
+ styleName = pFoundry->FindActuralStyleName("Primary");
+
+ XFIndexTemplate * pTemplate1 = new XFIndexTemplate();
+ pTemplate1->AddEntry(enumXFIndexTemplateText,"");
+ pTemplate1->AddEntry(enumXFIndexTemplateTab,"");
+ pTemplate1->AddEntry(enumXFIndexTemplatePage,"");
+ //pXFIndex->AddTemplate(OUString::number(1),"Primary",pTemplate1);
+ pXFIndex->AddTemplate(OUString::number(1),styleName,pTemplate1);
+
+ XFIndexTemplate * pTemplate2 = new XFIndexTemplate();
+ pTemplate2->AddEntry(enumXFIndexTemplateText,"");
+ pTemplate2->AddEntry(enumXFIndexTemplateTab,"");
+ pTemplate2->AddEntry(enumXFIndexTemplatePage,"");
+ XFIndexTemplate * pTemplate3 = new XFIndexTemplate();
+ pTemplate3->AddEntry(enumXFIndexTemplateText,"");
+ pTemplate3->AddEntry(enumXFIndexTemplateTab,"");
+ pTemplate3->AddEntry(enumXFIndexTemplatePage,"");
+
+ if (pIndexSection && pIndexSection->IsFormatRunin())
+ {
+ //pXFIndex->AddTemplate(OUString::number(2),"Primary",pTemplate2);
+ //pXFIndex->AddTemplate(OUString::number(3),"Primary",pTemplate3);
+ pXFIndex->AddTemplate(OUString::number(2),styleName,pTemplate2);
+ pXFIndex->AddTemplate(OUString::number(3),styleName,pTemplate3);
+ }
+ else
+ {
+ //pXFIndex->AddTemplate(OUString::number(2),"Secondary",pTemplate2);
+ //pXFIndex->AddTemplate(OUString::number(3),"Secondary",pTemplate3);
+ styleName = pFoundry->FindActuralStyleName("Secondary");
+ pXFIndex->AddTemplate(OUString::number(2),styleName,pTemplate2);
+ pXFIndex->AddTemplate(OUString::number(3),styleName,pTemplate3);
+ }
+}
+
+LwpMasterPage::LwpMasterPage(LwpPara* pPara, LwpPageLayout* pLayout)
+ :m_bNewSection(false),m_pPara(pPara),m_pLayout(pLayout)
+{
+}
+
+/**
+ * @descr: Register master page style for para style and register section style if necessary
+ *
+ */
+void LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
+{
+ //if there is no other frib after current frib, register master page in starting para of next page
+ LwpStory* pStory = nullptr;
+ if (IsNextPageType()&&(!pFrib->HasNextFrib()))
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+
+ if (pStory)
+ {
+ pStory->SetCurrentLayout(m_pLayout);
+ RegisterFillerPageStyle();
+ return;
+ }
+
+ m_bNewSection = false;
+ //sal_Bool bSectionColumns = sal_False;
+
+ std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
+ *xOverStyle = *(m_pPara->GetXFParaStyle());
+ xOverStyle->SetStyleName("");
+
+ LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType();
+ switch(eUserType)
+ {
+ case LwpLayout::StartWithinColume://not support now
+ {
+ m_bNewSection = false;
+ break;
+ }
+ case LwpLayout::StartWithinPage:
+ {
+ m_bNewSection = true;
+ //bSectionColumns = sal_True;
+ break;
+ }
+ case LwpLayout::StartOnNextPage://fall through
+ case LwpLayout::StartOnOddPage: //fall through
+ case LwpLayout::StartOnEvenPage:
+ {
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (pStory)
+ {
+ pStory->SetCurrentLayout(m_pLayout);
+ //get odd page layout when the current pagelayout is mirror
+ m_pLayout = pStory->GetCurrentLayout();
+ m_bNewSection = IsNeedSection();
+ //bSectionColumns = m_bNewSection;
+ xOverStyle->SetMasterPage(m_pLayout->GetStyleName());
+ RegisterFillerPageStyle();
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ //register tab style;
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (!pStory)
+ return;
+
+ pStory->SetTabLayout(m_pLayout);
+ m_pPara->RegisterTabStyle(xOverStyle.get());
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+ //register section style here
+ if(!m_bNewSection)
+ return;
+
+ std::unique_ptr<XFSectionStyle> pSectStyle(new XFSectionStyle());
+ //set margin
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ LwpPageLayout* pCurrentLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
+ if (pCurrentLayout)
+ {
+ double fLeft = m_pLayout->GetMarginsValue(MARGIN_LEFT) - pCurrentLayout->GetMarginsValue(MARGIN_LEFT);
+ double fRight = m_pLayout->GetMarginsValue(MARGIN_RIGHT) - pCurrentLayout->GetMarginsValue(MARGIN_RIGHT);
+ pSectStyle->SetMarginLeft(fLeft);
+ pSectStyle->SetMarginRight(fRight);
+ }
+
+ XFColumns* pColumns = m_pLayout->GetXFColumns();
+ if(pColumns)
+ {
+ pSectStyle->SetColumns(pColumns);
+ }
+ m_SectionStyleName = pXFStyleManager->AddStyle(std::move(pSectStyle)).m_pStyle->GetStyleName();
+}
+
+/**
+ * @descr: Whether it needs to create a new section
+ *
+ */
+bool LwpMasterPage::IsNeedSection()
+{
+ bool bNewSection = false;
+ //get story
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ //if pagelayout is modified, register the pagelayout
+ if (pStory && pStory->IsPMModified())
+ {
+ bNewSection = pStory->IsNeedSection();
+ }
+ return bNewSection;
+}
+
+/**
+ * @descr: Create XFSection if necessary
+ *
+ */
+XFSection* LwpMasterPage::CreateXFSection()
+{
+ if(m_bNewSection)
+ {
+ //new a section
+ XFSection* pXFSection = new XFSection();
+ pXFSection->SetStyleName(m_SectionStyleName);
+ return pXFSection;
+ }
+ return nullptr;
+}
+
+/**
+ * @descr: Parse section
+ *
+ */
+void LwpMasterPage::ParseSection(LwpFrib* pFrib)
+{
+ LwpFribPtr& rFribPtr = m_pPara->GetFribs();
+ //XFParagraph * pXFPara = rFribPtr.GetXFPara();
+
+ //parse fillerpage text
+ if(m_pLayout->HasFillerPageText(m_pPara->GetFoundry()))
+ {
+ XFParagraph *pPara = new XFParagraph();
+ pPara->SetStyleName(m_FillerPageStyleName);
+ m_pPara->AddXFContent(pPara);
+ rFribPtr.SetXFPara(pPara);
+
+ m_pLayout->ConvertFillerPageText(m_pPara->GetXFContainer());
+ }
+ //create a new section and add it to container
+ XFContentContainer* pContent = CreateXFSection();
+ if(pContent)
+ {
+ LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+ //delete the additional blank para
+ XFParagraph* pCurrPara = rFribPtr.GetXFPara();
+ if(!pCurrPara->HasContents())
+ {
+ XFContentContainer* pCurrContainer = m_pPara->GetXFContainer();
+ if(pFrib->HasNextFrib() && (pCurrContainer->GetLastContent() == pCurrPara))
+ {
+ pCurrContainer->RemoveLastContent();
+ }
+ }
+ if (pStory)
+ pStory->AddXFContent( pContent );
+ }
+ else
+ {
+ LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+ pContent = pStory ? pStory->GetXFContent() : nullptr;
+ }
+ if(pContent)
+ {
+ m_pPara->SetXFContainer( pContent );
+ }
+ //out put the contents after the section frib in the same para.
+ if(pFrib->HasNextFrib())
+ {
+ XFParagraph *pNextPara = new XFParagraph();
+ pNextPara->SetStyleName(m_StyleName);
+ m_pPara->AddXFContent(pNextPara);
+ rFribPtr.SetXFPara(pNextPara);
+ }
+
+}
+
+/**
+ * @descr: Register filler page text style
+ *
+ */
+void LwpMasterPage::RegisterFillerPageStyle()
+{
+ LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType();
+ if(eUserType==LwpLayout::StartOnOddPage
+ ||eUserType==LwpLayout::StartOnEvenPage)
+ {
+ if(m_pLayout->HasFillerPageText(m_pPara->GetFoundry()))
+ {
+ std::unique_ptr<XFParaStyle> pPagebreakStyle(new XFParaStyle);
+ *pPagebreakStyle = *(m_pPara->GetXFParaStyle());
+ pPagebreakStyle->SetStyleName("");
+ pPagebreakStyle->SetBreaks(enumXFBreakAftPage);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_FillerPageStyleName= pXFStyleManager->AddStyle(std::move(pPagebreakStyle)).m_pStyle->GetStyleName();
+ }
+ }
+}
+
+/**
+ * @descr: Whether the layout is next page type
+ *
+ */
+bool LwpMasterPage::IsNextPageType()
+{
+ LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType();
+ return eUserType == LwpLayout::StartOnNextPage
+ || eUserType == LwpLayout::StartOnOddPage
+ || eUserType == LwpLayout::StartOnEvenPage;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribsection.hxx b/lotuswordpro/source/filter/lwpfribsection.hxx
new file mode 100644
index 000000000..0f1da0ff6
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribsection.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * the class for section frib and process section and page layout
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBSECTION_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBSECTION_HXX
+
+#include <lwpfrib.hxx>
+#include "lwppara.hxx"
+
+/**
+ * @brief Process page layout for inserting pagelayout or section
+ *
+ */
+class LwpMasterPage
+{
+public:
+ LwpMasterPage(LwpPara* pPara, LwpPageLayout* pLayout);
+
+public:
+ //for page layout register and parse
+ void RegisterMasterPage(LwpFrib* pFrib);
+ void RegisterFillerPageStyle();
+ void ParseSection(LwpFrib* pFrib);
+ XFSection* CreateXFSection();
+
+ bool IsNextPageType();
+
+private:
+ bool IsNeedSection();
+
+private:
+ bool m_bNewSection;
+ OUString m_FillerPageStyleName;
+ OUString m_SectionStyleName;
+ OUString m_StyleName; //master page style name
+
+ LwpPara* m_pPara;
+ LwpPageLayout* m_pLayout;
+};
+
+/**
+ * @brief FRIB_TAB_SECTION object
+ *
+ */
+class LwpSection;
+class XFIndex;
+class LwpFribSection : public LwpFrib
+{
+public:
+ explicit LwpFribSection(LwpPara* pPara);
+ virtual ~LwpFribSection() override;
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ LwpSection* GetSection();
+ void RegisterSectionStyle();
+ void ParseSection();
+ void SetSectionName();
+
+ LwpPageLayout* GetPageLayout();
+
+private:
+ void SetDefaultAlphaIndex(XFIndex* pXFIndex);
+
+private:
+ LwpObjectID m_Section;
+ std::unique_ptr<LwpMasterPage> m_pMasterPage;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribtable.cxx b/lotuswordpro/source/filter/lwpfribtable.cxx
new file mode 100644
index 000000000..a6c50b86f
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribtable.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "lwpfribtable.hxx"
+#include "lwppara.hxx"
+#include "lwptablelayout.hxx"
+#include <lwpchangemgr.hxx>
+#include <lwpglobalmgr.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfchange.hxx>
+
+/**
+ * @short: Read table frib
+ */
+void LwpFribTable::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_objTable.ReadIndexed(pObjStrm);
+}
+
+LwpSuperTableLayout* LwpFribTable::GetSuperTable()
+{
+ return dynamic_cast<LwpSuperTableLayout*>(m_objTable.obj().get());
+}
+
+void LwpFribTable::RegisterNewStyle()
+{
+ LwpSuperTableLayout* pSuper = GetSuperTable();
+ if (pSuper)
+ pSuper->RegisterNewStyle();
+ XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
+ if(HasNextFrib())
+ {
+ if (pOldStyle->GetMasterPage().isEmpty())
+ m_StyleName = pOldStyle->GetStyleName();
+ else
+ {
+ std::unique_ptr<XFParaStyle> xParaStyle(new XFParaStyle);
+ *xParaStyle = *pOldStyle;
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xParaStyle)).m_pStyle->GetStyleName();
+ }
+ }
+}
+
+void LwpFribTable::XFConvert(XFContentContainer* pCont)
+{
+ XFContentContainer* pXFContentContainer = pCont;
+ LwpSuperTableLayout* pSuper = GetSuperTable();
+ if (!pSuper)
+ return;
+ sal_uInt8 nType = pSuper->GetRelativeType();
+ rtl::Reference<LwpVirtualLayout> xContainer(pSuper->GetContainerLayout());
+ if (!xContainer.is())
+ return;
+ if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
+ && !xContainer->IsCell())
+ {
+ pXFContentContainer = m_pPara->GetXFContainer();
+ //delete the additional blank para
+ XFParagraph* pCurrPara = m_pPara->GetFribs().GetXFPara();
+ if (pXFContentContainer && !pCurrPara->HasContents())
+ {
+ if(pXFContentContainer->GetLastContent() == pCurrPara)
+ {
+ pXFContentContainer->RemoveLastContent();
+ }
+ }
+ }
+ else if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
+ {
+ //same page as text and in frame
+ if (xContainer->IsFrame())
+ {
+ pXFContentContainer = m_pPara->GetXFContainer();
+ }
+ else if (xContainer->IsCell())
+ {
+ //same page as text and in cell, get the first xfpara
+ rtl::Reference<XFContent> first(
+ pCont->FindFirstContent(enumXFContentPara));
+ XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
+ if(pXFFirtPara)
+ pXFContentContainer = pXFFirtPara;
+ }
+ }
+ OUString sChangeID;
+ if(m_bRevisionFlag)
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ sChangeID = pChangeMgr->GetChangeID(this);
+ if (!sChangeID.isEmpty() && pXFContentContainer)
+ {
+ rtl::Reference<XFChangeStart> xChangeStart(new XFChangeStart);
+ xChangeStart->SetChangeID(sChangeID);
+ pXFContentContainer->Add(xChangeStart.get());
+ }
+ }
+
+ if (pXFContentContainer)
+ pSuper->XFConvert(pXFContentContainer);
+
+ if(m_bRevisionFlag)
+ {
+ if (!sChangeID.isEmpty() && pXFContentContainer)
+ {
+ rtl::Reference<XFChangeEnd> xChangeEnd(new XFChangeEnd);
+ xChangeEnd->SetChangeID(sChangeID);
+ pXFContentContainer->Add(xChangeEnd.get());
+ }
+ }
+
+ if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
+ && HasNextFrib())
+ {
+ rtl::Reference<XFParagraph> xXFPara(new XFParagraph);
+ xXFPara->SetStyleName(m_StyleName);
+ m_pPara->AddXFContent(xXFPara.get());
+ m_pPara->GetFribs().SetXFPara(xXFPara.get());
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribtable.hxx b/lotuswordpro/source/filter/lwpfribtable.hxx
new file mode 100644
index 000000000..cdc62744c
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribtable.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBTABLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBTABLE_HXX
+
+#include <lwpfrib.hxx>
+
+class LwpSuperTableLayout;
+class LwpFribTable : public LwpFrib
+{
+public:
+ explicit LwpFribTable( LwpPara* pPara ) : LwpFrib(pPara){}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ LwpSuperTableLayout* GetSuperTable();
+ void RegisterNewStyle();
+ void XFConvert(XFContentContainer* pCont);
+private:
+ LwpObjectID m_objTable;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribtext.cxx b/lotuswordpro/source/filter/lwpfribtext.cxx
new file mode 100644
index 000000000..0ba910ab7
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribtext.cxx
@@ -0,0 +1,481 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpglobalmgr.hxx>
+#include "lwpfribtext.hxx"
+#include "lwpcharsetmgr.hxx"
+#include "lwphyperlinkmgr.hxx"
+#include <lwptools.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xfbookmark.hxx>
+#include <xfilter/xfentry.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/xfcrossref.hxx>
+#include <xfilter/xfpagenumber.hxx>
+#include <xfilter/xfdocfield.hxx>
+#include <xfilter/xfdatestyle.hxx>
+#include <xfilter/xftimestyle.hxx>
+#include <xfilter/xfdate.hxx>
+#include <xfilter/xfannotation.hxx>
+#include <xfilter/xfpagecount.hxx>
+
+LwpFribText::LwpFribText( LwpPara *pPara, bool bNoUnicode )
+ : LwpFrib(pPara), m_bNoUnicode(bNoUnicode)
+{}
+
+void LwpFribText::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
+{
+ if( len<1 )
+ return;
+
+ rtl_TextEncoding rEncode;
+ if(m_bNoUnicode)
+ {
+ rEncode = RTL_TEXTENCODING_ISO_8859_1;
+ }
+ else
+ {
+ if (m_pModifiers && m_pModifiers->CodePage)
+ rEncode = LwpCharSetMgr::GetInstance()->
+ GetTextCharEncoding(m_pModifiers->CodePage);
+ else
+ rEncode = LwpCharSetMgr::GetTextCharEncoding();
+ }
+ LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
+}
+
+void LwpFribText::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
+{
+ if (!pStory)
+ return;
+ LwpHyperlinkMgr* pHyperlink = pStory->GetHyperlinkMgr();
+ if (pHyperlink->GetHyperlinkFlag())
+ LwpFrib::ConvertHyperLink(pXFPara,pHyperlink,GetText());
+ else
+ LwpFrib::ConvertChars(pXFPara,GetText());
+}
+
+/**
+ * @short: Reading mothed of paranumber frib.
+ * @param: pObjStrm wordpro object stream.
+ * @param: len length of the frib
+ */
+void LwpFribParaNumber::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_nStyleID = pObjStrm->QuickReaduInt16();
+ m_nNumberChar = pObjStrm->QuickReaduInt16();
+ m_nLevel = pObjStrm->QuickReaduInt16();
+ m_nStart = pObjStrm->QuickReaduInt16();
+}
+
+/**
+ * @short: default constructor of LwpFribDocVar
+ */
+LwpFribDocVar::LwpFribDocVar(LwpPara* pPara)
+ : LwpFrib(pPara), m_nType(0)
+{
+}
+/**
+ * @short: destructor of LwpFribDocVar
+ */
+LwpFribDocVar::~LwpFribDocVar()
+{
+}
+/**
+ * @short: Reading mothed of document variable frib.
+ * @param: pObjStrm wordpro object stream.
+ * @param: len length of the frib
+ */
+void LwpFribDocVar::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_nType = pObjStrm->QuickReaduInt16();
+ m_aName.Read(pObjStrm);
+}
+
+/**
+ * @short: register style for doc field (text style,date style)
+ */
+void LwpFribDocVar::RegisterStyle(LwpFoundry* pFoundry)
+{
+ LwpFrib::RegisterStyle(pFoundry);
+
+ switch(m_nType)
+ {
+ case DATECREATED:
+ case DATELASTREVISION:
+ {
+ RegisterDefaultTimeStyle();
+ }
+ break;
+ case TOTALEDITTIME:
+ RegisterTotalTimeStyle();
+ break;
+ default:
+ break;
+ }
+}
+
+/**
+ * @short: register default time style for doc field
+ */
+void LwpFribDocVar::RegisterDefaultTimeStyle()
+{
+ std::unique_ptr<XFDateStyle> pDateStyle(new XFDateStyle);//use the default format
+
+ pDateStyle->AddMonth();
+ pDateStyle->AddText("/");
+ pDateStyle->AddMonthDay();
+ pDateStyle->AddText("/");
+ pDateStyle->AddYear();
+ pDateStyle->AddText(",");
+ pDateStyle->AddHour();
+ pDateStyle->AddText(":");
+ pDateStyle->AddMinute();
+ pDateStyle->AddText(":");
+ pDateStyle->AddSecond();
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_TimeStyle = pXFStyleManager->AddStyle(std::move(pDateStyle)).m_pStyle->GetStyleName();
+}
+void LwpFribDocVar::RegisterTotalTimeStyle()
+{
+ std::unique_ptr<XFTimeStyle> pTimeStyle(new XFTimeStyle);//use the default format
+ pTimeStyle->SetTruncate(false);
+ pTimeStyle->AddMinute();
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_TimeStyle = pXFStyleManager->AddStyle(std::move(pTimeStyle)).m_pStyle->GetStyleName();
+}
+
+/**
+ * @short: convert the doc info field
+ */
+void LwpFribDocVar::XFConvert(XFContentContainer* pXFPara)
+{
+ XFContent* pContent=nullptr;
+ switch(m_nType)
+ {
+ case FILENAME:
+ {
+ pContent = new XFFileName;
+ static_cast<XFFileName*>(pContent)->SetType("FileName");
+ break;
+ }
+ case PATH:
+ {
+ pContent = new XFFileName;
+ static_cast<XFFileName*>(pContent)->SetType("Path");
+ break;
+ }
+ case DESCRIPTION:
+ pContent = new XFDescription;
+ break;
+ case DATECREATED:
+ {
+ pContent = new XFCreateTime;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ case DATELASTREVISION:
+ {
+ pContent = new XFLastEditTime;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ case NUMPAGES:
+ pContent = new XFPageCount;
+ break;
+ case NUMWORDS:
+ pContent = new XFWordCount;
+ break;
+ case NUMCHARS:
+ pContent = new XFCharCount;
+ break;
+ case TOTALEDITTIME:
+ {
+ pContent = new XFTotalEditTime;
+ pContent->SetStyleName(m_TimeStyle);
+ break;
+ }
+ case KEYWORDS:
+ pContent = new XFKeywords;
+ break;
+ case CREATEDBY:
+ pContent = new XFInitialCreator;
+ break;
+ case DOCSIZE:
+ {
+/* pContent = new XFAnnotation;
+ XFTextContent* pSpan = new XFTextContent();
+ pSpan->SetText("Document Size is Here");
+ XFParagraph* pPara = new XFParagraph;
+ pPara->Add(pSpan);
+ static_cast<XFAnnotation*>(pContent)->Add(pPara);
+ break;
+*/
+ OUString text = "<Document Size>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case SMARTMASTER:
+ {
+ OUString text = "<Smart master>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case DIVISIONNAME:
+ {
+ OUString text = "<Division name>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case SECTIONNAME:
+ {
+ OUString text = "<Section name>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONCREATEBY:
+ {
+ OUString text = "<Version Creat by>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONCREATEDATE:
+ {
+ OUString text = "<Version Creat date>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONOTHEREDITORS:
+ {
+ OUString text = "<Version other Editors>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONNAME:
+ {
+ OUString text = "<Version Name>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONNUMBER:
+ {
+ OUString text = "<Version Numbers>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case ALLVERSIONNAME:
+ {
+ OUString text = "<All Version Name>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONREMARK:
+ {
+ OUString text = "<Version Remark>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case DOCUMENTCATEGORY:
+ {
+ OUString text = "<Document Category>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONLASTDATE:
+ {
+ OUString text = "<Version Last Modify Date>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case VERSIONLASTEDITOR:
+ {
+ OUString text = "<Version Last Editor>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case LASTEDIT:
+ {
+ OUString text = "<Last Editor>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case OTHEREDITORS:
+ {
+ OUString text = "<Other Editors>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ case NUMOFREVISION:
+ {
+ OUString text = "<Number of Revision>";
+ LwpFrib::ConvertChars(pXFPara,text);
+ return;
+ }
+ default:
+ return;
+ }
+ if (m_ModFlag)//(m_pModifiers)
+ {
+ XFTextSpan *pSpan = new XFTextSpan;
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ }
+ else
+ pXFPara->Add(pContent);
+
+}
+/**
+ * @short: Read unicode
+ */
+void LwpFribUnicode::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
+{
+ if(len>1)
+ {
+ rtl_TextEncoding rEncode;
+
+ if (m_pModifiers && m_pModifiers->CodePage)
+ rEncode = LwpCharSetMgr::GetInstance()->
+ GetTextCharEncoding(m_pModifiers->CodePage);
+ else
+ rEncode = LwpCharSetMgr::GetTextCharEncoding();
+
+ LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
+
+ }
+ else
+ pObjStrm->SeekRel(len);
+}
+
+void LwpFribUnicode::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
+{
+ if (!pStory)
+ return;
+ LwpHyperlinkMgr* pHyperlink = pStory->GetHyperlinkMgr();
+ if (pHyperlink->GetHyperlinkFlag())
+ LwpFrib::ConvertHyperLink(pXFPara,pHyperlink,GetText());
+ else
+ LwpFrib::ConvertChars(pXFPara,GetText());
+}
+
+/**
+ * @short: Read page number
+ */
+void LwpFribPageNumber::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
+{
+ m_nNumStyle = pObjStrm->QuickReaduInt16();
+ m_aBefText.Read(pObjStrm);
+ m_aAfterText.Read(pObjStrm);
+ m_nStartNum = pObjStrm->QuickReaduInt16();
+ m_nStartOnPage = pObjStrm->QuickReaduInt16();
+ m_nFlag = pObjStrm->QuickReaduInt16();
+}
+
+void LwpFribPageNumber::XFConvert(XFContentContainer* pXFPara)
+{
+ if (m_nNumStyle == 0x0)
+ return;
+ XFPageNumber* pNum = new XFPageNumber;
+// pNum->SetSelect("current");
+ switch(m_nNumStyle)
+ {
+ case 0x01:
+ pNum->SetNumFmt("1");
+ break;
+ case 0x02:
+ pNum->SetNumFmt("A");
+ break;
+ case 0x03:
+ pNum->SetNumFmt("a");
+ break;
+ case 0x04:
+ pNum->SetNumFmt("I");
+ break;
+ case 0x05:
+ pNum->SetNumFmt("i");
+ break;
+ }
+ OUString styleName = GetStyleName();
+ if (!m_aBefText.str().isEmpty())
+ {
+ OUString textStr = m_aBefText.str();
+ XFTextSpan *pBef = new XFTextSpan(textStr,styleName);
+ pXFPara->Add(pBef);
+ }
+ if (m_ModFlag)//(m_pModifiers)
+ {
+ XFTextSpan *pSpan = new XFTextSpan;
+ pSpan->SetStyleName(styleName);
+ pSpan->Add(pNum);
+ pXFPara->Add(pSpan);
+ }
+ else
+ pXFPara->Add(pNum);
+ if (!m_aAfterText.str().isEmpty())
+ {
+ OUString textStr = m_aAfterText.str();
+ XFTextSpan *pAfter = new XFTextSpan(textStr,styleName);
+ pXFPara->Add(pAfter);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribtext.hxx b/lotuswordpro/source/filter/lwpfribtext.hxx
new file mode 100644
index 000000000..cc1c5b83c
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpfribtext.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBTEXT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFRIBTEXT_HXX
+
+#include <lwpfrib.hxx>
+#include "lwpstory.hxx"
+class LwpFribText : public LwpFrib
+{
+public:
+ LwpFribText( LwpPara* pPara, bool bNoUnicode);
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ void XFConvert(XFContentContainer* pXFPara,LwpStory* pStory);
+private:
+ OUString m_Content;
+ bool m_bNoUnicode;
+public:
+ const OUString& GetText() const {return m_Content;}
+};
+
+class LwpFribHardSpace : public LwpFrib
+{
+public:
+ explicit LwpFribHardSpace( LwpPara* pPara ) : LwpFrib(pPara){}
+};
+
+class LwpFribSoftHyphen : public LwpFrib
+{
+public:
+ explicit LwpFribSoftHyphen( LwpPara* pPara ) : LwpFrib(pPara){}
+};
+
+class LwpFribParaNumber : public LwpFrib
+{
+public:
+ explicit LwpFribParaNumber( LwpPara* pPara ) : LwpFrib(pPara),
+ m_nStyleID(0), m_nNumberChar(0), m_nLevel(1), m_nStart(0){}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+
+ inline sal_uInt16 GetStyleID() const;
+
+ inline sal_uInt16 GetNumberChar() const;
+
+ inline sal_uInt16 GetStart() const;
+
+private:
+ sal_uInt16 m_nStyleID;
+ sal_uInt16 m_nNumberChar;
+ sal_uInt16 m_nLevel;
+ sal_uInt16 m_nStart;
+};
+inline sal_uInt16 LwpFribParaNumber::GetStyleID() const
+{
+ return m_nStyleID;
+}
+inline sal_uInt16 LwpFribParaNumber::GetNumberChar() const
+{
+ return m_nNumberChar;
+}
+inline sal_uInt16 LwpFribParaNumber::GetStart() const
+{
+ return m_nStart;
+}
+
+class LwpFribDocVar : public LwpFrib
+{
+public:
+ explicit LwpFribDocVar( LwpPara* pPara );
+
+ virtual ~LwpFribDocVar() override;
+
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+
+ void RegisterStyle(LwpFoundry* pFoundry) override;
+
+ void XFConvert(XFContentContainer* pXFPara);
+
+ enum {
+ FILENAME = 0x02,
+ PATH = 0x03,
+ SMARTMASTER = 0x04,
+ DESCRIPTION = 0x05,
+ DATECREATED = 0x06,
+ DATELASTREVISION = 0x07,
+ TOTALEDITTIME = 0x08,
+ NUMPAGES= 0x09,
+ NUMWORDS= 0x0a,
+ NUMCHARS = 0x0b,
+ DOCSIZE = 0x0c,
+ DIVISIONNAME = 0x0d,
+ SECTIONNAME = 0x0e,
+ VERSIONCREATEBY = 0x0f,
+ VERSIONCREATEDATE = 0x10,
+ VERSIONOTHEREDITORS = 0x11,
+ VERSIONNAME = 0x12,
+ VERSIONNUMBER = 0x13,
+ ALLVERSIONNAME = 0x14,
+ VERSIONREMARK = 0x15,
+ DOCUMENTCATEGORY = 0x16,
+ VERSIONLASTDATE = 0x17,
+ VERSIONLASTEDITOR = 0x18,
+ KEYWORDS = 0x19,
+ CREATEDBY = 0x1a,
+ LASTEDIT = 0x1b,
+ OTHEREDITORS = 0x1c,
+ NUMOFREVISION = 0x1d,
+ };
+
+private:
+ sal_uInt16 m_nType;
+ LwpAtomHolder m_aName;
+ OUString m_TimeStyle;
+ void RegisterDefaultTimeStyle();
+ void RegisterTotalTimeStyle();
+};
+
+class LwpFribTab : public LwpFrib
+{
+public:
+ explicit LwpFribTab( LwpPara* pPara ) : LwpFrib(pPara){}
+};
+
+class LwpFribUnicode: public LwpFrib
+{
+public:
+ explicit LwpFribUnicode( LwpPara* pPara ) : LwpFrib(pPara){}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ void XFConvert(XFContentContainer* pXFPara,LwpStory* pStory);
+private:
+ OUString m_Content;
+public:
+ const OUString& GetText() const {return m_Content;}
+};
+
+class LwpFribPageNumber : public LwpFrib
+{
+public:
+ explicit LwpFribPageNumber(LwpPara* pPara) : LwpFrib(pPara),
+ m_nNumStyle(0), m_nStartNum(1), m_nStartOnPage(1), m_nFlag(0){}
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ void XFConvert(XFContentContainer* pXFPara);
+private:
+ sal_uInt16 m_nNumStyle;
+ LwpAtomHolder m_aBefText;
+ LwpAtomHolder m_aAfterText;
+ sal_uInt16 m_nStartNum;
+ sal_uInt16 m_nStartOnPage;
+ sal_uInt16 m_nFlag;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpglobalmgr.cxx b/lotuswordpro/source/filter/lwpglobalmgr.cxx
new file mode 100644
index 000000000..05fa59033
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpglobalmgr.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpglobalmgr.hxx>
+#include <osl/thread.hxx>
+std::map< sal_uInt32,LwpGlobalMgr* > LwpGlobalMgr::m_ThreadMap;
+LwpGlobalMgr::LwpGlobalMgr(LwpSvStream* pSvStream)
+{
+ if (pSvStream)
+ m_pObjFactory.reset( new LwpObjectFactory(pSvStream) );
+ m_pBookmarkMgr.reset( new LwpBookmarkMgr );
+ m_pChangeMgr.reset( new LwpChangeMgr );
+ m_pXFFontFactory.reset( new XFFontFactory );
+ m_pXFStyleManager.reset( new XFStyleManager );
+}
+
+LwpGlobalMgr::~LwpGlobalMgr()
+{
+ m_pObjFactory.reset();
+ m_pBookmarkMgr.reset();
+ m_pChangeMgr.reset();
+ m_pXFFontFactory.reset();
+ m_pXFStyleManager.reset();
+ m_EditorAttrMap.clear();
+}
+
+LwpGlobalMgr* LwpGlobalMgr::GetInstance(LwpSvStream* pSvStream)
+{
+ sal_uInt32 nThreadID = osl::Thread::getCurrentIdentifier();
+ auto iter = m_ThreadMap.find(nThreadID);
+ if (iter == m_ThreadMap.end())
+ {
+ LwpGlobalMgr* pInstance = new LwpGlobalMgr(pSvStream);
+ m_ThreadMap[nThreadID] = pInstance;
+ return pInstance;
+ }
+ else
+ return iter->second;
+}
+
+void LwpGlobalMgr::DeleteInstance()
+{
+ sal_uInt32 nThreadID = osl::Thread::getCurrentIdentifier();
+ auto iter = m_ThreadMap.find(nThreadID);
+ if (iter != m_ThreadMap.end())
+ {
+ delete iter->second;
+ iter->second = nullptr;
+ m_ThreadMap.erase(iter);
+ }
+}
+
+void LwpGlobalMgr::SetEditorAttrMap(sal_uInt16 nID, LwpEditorAttr* pAttr)
+{
+ m_EditorAttrMap[nID].reset(pAttr);
+}
+
+OUString LwpGlobalMgr::GetEditorName(sal_uInt8 nID)
+{
+ auto iter = m_EditorAttrMap.find(nID);
+ if (iter != m_EditorAttrMap.end())
+ return iter->second->cName.str();
+ return OUString();
+}
+
+XFColor LwpGlobalMgr::GetHighlightColor(sal_uInt8 nID)
+{
+ auto iter = m_EditorAttrMap.find(nID);
+ if (iter != m_EditorAttrMap.end())
+ {
+ LwpColor aLwpColor = iter->second->cHiLiteColor;
+ XFColor aColor(aLwpColor.GetRed(),aLwpColor.GetGreen(),aLwpColor.GetBlue());
+ return aColor;
+ }
+ else
+ {
+ XFColor aColor(255,255,0);//yellow
+ return aColor;
+ }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
new file mode 100644
index 000000000..efb93ab32
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -0,0 +1,693 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**
+ * @file
+ * For LWP filter architecture prototype
+*/
+#include <stdio.h>
+
+#include <memory>
+
+#include "lwp9reader.hxx"
+#include "lwpgrfobj.hxx"
+#include "lwpsdwfileloader.hxx"
+#include "bento.hxx"
+
+#include <lwpglobalmgr.hxx>
+#include <o3tl/numeric.hxx>
+#include "lwpframelayout.hxx"
+
+#include <xfilter/xfframe.hxx>
+#include <xfilter/xfimage.hxx>
+#include <xfilter/xfimagestyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xfannotation.hxx>
+
+//For chart
+#include <string.h>
+
+#include <osl/thread.h>
+#include <sal/log.hxx>
+
+#define EF_NONE 0x0000
+#define EF_ODMA 0x0002
+
+LwpGraphicObject::LwpGraphicObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpGraphicOleObject(objHdr, pStrm)
+ , m_nCachedBaseLine(0)
+ , m_bIsLinked(0)
+ , m_bCompressed(0)
+{
+}
+
+LwpGraphicObject::~LwpGraphicObject()
+{
+}
+
+void LwpGraphicObject::Read()
+{
+ LwpGraphicOleObject::Read();
+ m_pObjStrm->QuickReaduInt16(); //disksize
+ sal_uInt16 strsize = m_pObjStrm->QuickReaduInt16();
+ if (strsize<AFID_MAX_FILE_FORMAT_SIZE)
+ {
+ m_pObjStrm->QuickRead(m_sDataFormat,strsize);
+ m_sDataFormat[strsize] = '\0';
+ }
+ sal_uInt32 nServerContextSize = m_pObjStrm->QuickReaduInt32();
+ if (nServerContextSize > 0)
+ {
+ sal_uInt16 nMaxPossibleSize = m_pObjStrm->remainingSize();
+
+ if (nServerContextSize > nMaxPossibleSize)
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ nServerContextSize = nMaxPossibleSize;
+ }
+
+ std::vector<unsigned char> aServerContext(nServerContextSize);
+ m_pObjStrm->QuickRead(aServerContext.data(), static_cast<sal_uInt16>(nServerContextSize));
+ if (nServerContextSize > 44)
+ {
+ m_aIPData.nBrightness = aServerContext[14];
+ m_aIPData.nContrast = aServerContext[19];
+ m_aIPData.nEdgeEnchancement = aServerContext[24];
+ m_aIPData.nSmoothing = aServerContext[29];
+ m_aIPData.bInvertImage = (aServerContext[34] == 0x01);
+ m_aIPData.bAutoContrast = (aServerContext[44] == 0x00);
+ }
+ }
+ m_pObjStrm->QuickReaduInt16(); //disksize
+ strsize = m_pObjStrm->QuickReaduInt16();
+ if (strsize<AFID_MAX_FILE_FORMAT_SIZE)
+ {
+ m_pObjStrm->QuickRead(m_sServerContextFormat,strsize);
+ m_sServerContextFormat[strsize] = '\0';
+ }
+ if (nServerContextSize == 0)
+ {
+ if (strcmp(reinterpret_cast<char *>(m_sServerContextFormat), ".cht") == 0 &&
+ strcmp(reinterpret_cast<char *>(m_sDataFormat), ".sdw") == 0)
+ {
+ strcpy(reinterpret_cast<char *>(m_sServerContextFormat), ".lch");
+ strcpy(reinterpret_cast<char *>(m_sDataFormat), ".lch");
+ }
+ }
+ m_nCachedBaseLine = m_pObjStrm->QuickReadInt32();
+ m_bIsLinked = m_pObjStrm->QuickReadInt16();
+
+ if (m_bIsLinked)
+ {
+ m_LinkedFilePath = m_pObjStrm->QuickReadStringPtr();
+
+ sal_uInt32 nFilterContextSize = m_pObjStrm->QuickReaduInt32();
+ if (nFilterContextSize > 0)
+ {
+ sal_uInt16 nMaxPossibleSize = m_pObjStrm->remainingSize();
+
+ if (nFilterContextSize > nMaxPossibleSize)
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ nFilterContextSize = nMaxPossibleSize;
+ }
+
+ std::vector<unsigned char> aFilterContext(nFilterContextSize);
+ m_pObjStrm->QuickRead(aFilterContext.data(), static_cast<sal_uInt16>(nFilterContextSize));
+ }
+ if (LwpFileHeader::m_nFileRevision >= 0x000b)
+ {
+
+ // read external file object stuff
+ sal_uInt16 type = m_pObjStrm->QuickReaduInt16();
+ if ((EF_ODMA != type) && (EF_NONE != type)) // don't know about this
+ {
+ sal_uInt32 size = m_pObjStrm->QuickReaduInt32();
+ m_pObjStrm->SeekRel(static_cast<sal_uInt16>(size));
+ }
+ // else no external file object
+ }
+ }
+
+ if (LwpFileHeader::m_nFileRevision >= 0x000b)
+ {
+ m_bCompressed = m_pObjStrm->QuickReadInt16();
+ m_Cache.LinkedFileSize = m_pObjStrm->QuickReaduInt32();
+ m_Cache.LinkedFileTime = m_pObjStrm->QuickReaduInt32();
+ m_Cache.Width = m_pObjStrm->QuickReadInt32();
+ m_Cache.Height = m_pObjStrm->QuickReadInt32();
+ }
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000c)
+ {
+ m_WatermarkName = m_pObjStrm->QuickReadStringPtr();
+ }
+}
+
+void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
+{
+ if (m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w')
+ {
+ for (auto const& vXFDrawObject : m_vXFDrawObjects)
+ {
+ pCont->Add(vXFDrawObject.get());
+ }
+ }
+ else if (IsGrafFormatValid() && !m_vXFDrawObjects.empty())
+ {
+ XFImage* pImage = static_cast<XFImage*>(m_vXFDrawObjects.front().get());
+
+ if (m_bIsLinked)
+ {
+ OUString fileURL = LwpTools::convertToFileUrl(OUStringToOString(m_LinkedFilePath, osl_getThreadTextEncoding()));
+ pImage->SetFileURL(fileURL);
+ }
+ else
+ {
+ std::vector<sal_uInt8> aGrafData = GetRawGrafData();
+ pImage->SetImageData(aGrafData.data(), aGrafData.size());
+ }
+
+ pCont->Add(pImage);
+ }
+ else if(m_sServerContextFormat[1]=='t'&&m_sServerContextFormat[2]=='e'&&m_sServerContextFormat[3]=='x')
+ {
+ XFConvertEquation(pCont);
+ }
+}
+
+/**
+ * @descr judge if the graphic format is what we can support: bmp, jpg, wmf, gif, tgf(tif). other format will be filtered to
+ * these formats by Word Pro.
+ * @return sal_True if yes sal_False if not.
+ */
+bool LwpGraphicObject::IsGrafFormatValid() const
+{
+ return (m_sServerContextFormat[1]=='b'&& m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='p')
+ || (m_sServerContextFormat[1]=='j' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='g')
+ || (m_sServerContextFormat[1]=='w' && m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='f')
+ || (m_sServerContextFormat[1]=='g' && m_sServerContextFormat[2]=='i' && m_sServerContextFormat[3]=='f')
+ || (m_sServerContextFormat[1]=='t' && m_sServerContextFormat[2]=='g' && m_sServerContextFormat[3]=='f')
+ || (m_sServerContextFormat[1]=='p' && m_sServerContextFormat[2]=='n' && m_sServerContextFormat[3]=='g')
+ || (m_sServerContextFormat[1]=='e' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='s');
+}
+
+/**
+ * @descr create drawing object and image object.
+ */
+void LwpGraphicObject::RegisterStyle()
+{
+ if (m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w')
+ {
+ CreateDrawObjects();
+ }
+ // test codes for importing pictures
+ else if(IsGrafFormatValid())
+ {
+ CreateGrafObject();
+ }
+
+ if (m_sServerContextFormat[1]=='l'&&m_sServerContextFormat[2]=='c'&&m_sServerContextFormat[3]=='h')
+ {
+ rtl::Reference<LwpVirtualLayout> xMyLayout(GetLayout(nullptr));
+ if (xMyLayout.is() && xMyLayout->IsFrame())
+ {
+ std::unique_ptr<XFFrameStyle> pXFFrameStyle(new XFFrameStyle());
+ pXFFrameStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
+ pXFFrameStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelPara);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_strStyleName = pXFStyleManager->AddStyle(std::move(pXFFrameStyle)).m_pStyle->GetStyleName();
+ }
+ }
+
+}
+
+/**
+ * @descr create drawing object.
+ */
+void LwpGraphicObject::CreateDrawObjects()
+{
+ // if small file, use the compressed stream for BENTO
+ LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm;
+
+ std::unique_ptr<OpenStormBento::LtcBenContainer> pBentoContainer;
+ sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ if (ulRet != OpenStormBento::BenErr_OK)
+ return;
+
+ // get graphic object's bento object name
+ LwpObjectID& rMyID = GetObjectID();
+ std::string aGrfObjName;
+ GetBentoNamebyID(rMyID, aGrfObjName);
+
+ // get bento stream by the name
+ std::vector<sal_uInt8> aData = pBentoContainer->GetGraphicData(aGrfObjName.c_str());
+ if (!aData.empty())
+ {
+ SvMemoryStream aDrawObjStream(aData.data(), aData.size(), StreamMode::READ);
+
+ LwpSdwFileLoader fileLoader(&aDrawObjStream, this);
+ fileLoader.CreateDrawObjects(&m_vXFDrawObjects);
+ }
+}
+
+/**
+ * @descr create drawing object.
+ */
+void LwpGraphicObject::GetBentoNamebyID(LwpObjectID const & rMyID, std::string& rName)
+{
+ sal_uInt16 nHigh = rMyID.GetHigh();
+ sal_uInt32 nLow = rMyID.GetLow();
+ char pTempStr[32];
+ rName = std::string("Gr");
+ sprintf(pTempStr, "%X,%" SAL_PRIXUINT32, nHigh, nLow);
+ rName.append(pTempStr);
+}
+
+/**
+ * @descr get the image data read from bento stream according to the VO_GRAPHIC ID.
+ * @return the image data.
+ */
+std::vector<sal_uInt8> LwpGraphicObject::GetRawGrafData()
+{
+ std::vector<sal_uInt8> aGrafData;
+
+ // create graphic object
+ // if small file, use the compressed stream for BENTO
+ LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm;
+
+ std::unique_ptr<OpenStormBento::LtcBenContainer> pBentoContainer;
+ {
+ sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ if (ulRet != OpenStormBento::BenErr_OK)
+ return aGrafData;
+ }
+
+ // get graphic object's bento object name
+ LwpObjectID& rMyID = GetObjectID();
+ std::string aGrfObjName;
+ GetBentoNamebyID(rMyID, aGrfObjName);
+
+ // get bento stream by the name and read image data
+ return pBentoContainer->GetGraphicData(aGrfObjName.c_str());
+}
+
+/**
+ * @descr get the image data (only -D data) read from bento stream according to the VO_GRAPHIC ID.
+ * @param pGrafData the array to store the image data. the pointer need to be deleted outside.
+ * @return the length of the image data.
+ */
+sal_uInt32 LwpGraphicObject::GetGrafData(std::unique_ptr<sal_uInt8[]>& pGrafData)
+{
+ // create graphic object
+ // if small file, use the compressed stream for BENTO
+ LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm;
+
+ std::unique_ptr<OpenStormBento::LtcBenContainer> pBentoContainer;
+ sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
+ if (ulRet != OpenStormBento::BenErr_OK)
+ return 0;
+
+ SvStream* pGrafStream = nullptr;
+
+ // get graphic object's bento object name
+ LwpObjectID& rMyID = GetObjectID();
+ std::string aGrfObjName;
+ GetBentoNamebyID(rMyID, aGrfObjName);
+
+ char sDName[64]="";
+ sprintf(sDName, "%s-D", aGrfObjName.c_str());
+
+ // get bento stream by the name
+ pGrafStream = pBentoContainer->FindValueStreamWithPropertyName(sDName);
+
+ std::unique_ptr<SvMemoryStream> pMemGrafStream(static_cast<SvMemoryStream*>(pGrafStream));
+
+ if (pMemGrafStream)
+ {
+ // read image data
+ sal_uInt32 nDataLen = pGrafStream->TellEnd();
+
+ pGrafData.reset(new sal_uInt8 [nDataLen]);
+ pMemGrafStream->ReadBytes(pGrafData.get(), nDataLen);
+
+ return nDataLen;
+ }
+
+ return 0;
+}
+
+/**
+ * @descr create xf-image object and save it in the container: m_vXFDrawObjects.
+ */
+void LwpGraphicObject::CreateGrafObject()
+{
+ rtl::Reference<XFImage> pImage = new XFImage();
+
+ // set image processing styles
+ std::unique_ptr<XFImageStyle> xImageStyle(new XFImageStyle);
+ if (m_sServerContextFormat[1]!='w' || m_sServerContextFormat[2]!='m' || m_sServerContextFormat[3]!='f')
+ {
+ if (m_aIPData.nBrightness != 50)
+ {
+ sal_Int32 nSODCBrightness = static_cast<sal_Int32>(m_aIPData.nBrightness)*2 - 100;
+ xImageStyle->SetBrightness(nSODCBrightness);
+ }
+ if (m_aIPData.nContrast != 50)
+ {
+ sal_Int32 nSODCContrast = static_cast<sal_Int32>(80 - static_cast<double>(m_aIPData.nContrast)*1.6);
+ xImageStyle->SetContrast(nSODCContrast);
+ }
+ }
+
+ // set scale and crop styles
+ LwpAssociatedLayouts& rLayoutWithMe = GetLayoutsWithMe();
+ LwpFrameLayout* pMyFrameLayout =
+ static_cast<LwpFrameLayout*>(rLayoutWithMe.GetOnlyLayout().obj(VO_FRAMELAYOUT).get());
+ if (pMyFrameLayout)
+ {
+ LwpLayoutScale* pMyScale = pMyFrameLayout->GetLayoutScale();
+ LwpLayoutGeometry* pFrameGeo = pMyFrameLayout->GetGeometry();
+
+ // original image size
+ double fOrgGrafWidth = static_cast<double>(m_Cache.Width)/TWIPS_PER_CM;
+ double fOrgGrafHeight = static_cast<double>(m_Cache.Height)/TWIPS_PER_CM;
+
+ // get margin values
+ double fLeftMargin = pMyFrameLayout->GetMarginsValue(MARGIN_LEFT);
+ double fRightMargin = pMyFrameLayout->GetMarginsValue(MARGIN_RIGHT);
+ double fTopMargin = pMyFrameLayout->GetMarginsValue(MARGIN_TOP);
+ double fBottomMargin = pMyFrameLayout->GetMarginsValue(MARGIN_BOTTOM);
+
+ if (pMyScale && pFrameGeo)
+ {
+ if (fOrgGrafHeight == 0.0 || fOrgGrafWidth == 0.0)
+ throw o3tl::divide_by_zero();
+
+ // frame size
+ double fFrameWidth = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetWidth());
+ double fFrameHeight = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetHeight());
+
+ // calculate the displayed size of the frame
+ double fDisFrameWidth = fFrameWidth - (fLeftMargin+fRightMargin);
+ double fDisFrameHeight = fFrameHeight - (fTopMargin+fBottomMargin);
+
+ // scaled image size
+ double fSclGrafWidth = fOrgGrafWidth;
+ double fSclGrafHeight = fOrgGrafHeight;
+
+ // get scale mode
+ sal_uInt16 nScalemode = pMyScale->GetScaleMode();
+ if (nScalemode & LwpLayoutScale::CUSTOM)
+ {
+ fSclGrafWidth = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth());
+ fSclGrafHeight = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight());
+ }
+ else if (nScalemode & LwpLayoutScale::PERCENTAGE)
+ {
+ double fScalePercentage = static_cast<double>(pMyScale->GetScalePercentage()) / 1000;
+ fSclGrafWidth = fScalePercentage * fOrgGrafWidth;
+ fSclGrafHeight = fScalePercentage * fOrgGrafHeight;
+ }
+ else if (nScalemode & LwpLayoutScale::FIT_IN_FRAME)
+ {
+ if (pMyFrameLayout->IsFitGraphic())
+ {
+ fSclGrafWidth = fOrgGrafWidth;
+ fSclGrafHeight = fOrgGrafHeight;
+ }
+ else if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO)
+ {
+ if (fDisFrameHeight == 0.0)
+ throw o3tl::divide_by_zero();
+ if (fOrgGrafWidth/fOrgGrafHeight >= fDisFrameWidth/fDisFrameHeight)
+ {
+ fSclGrafWidth = fDisFrameWidth;
+ fSclGrafHeight = (fDisFrameWidth/fOrgGrafWidth) * fOrgGrafHeight;
+ }
+ else
+ {
+ fSclGrafHeight = fDisFrameHeight;
+ fSclGrafWidth = (fDisFrameHeight/fOrgGrafHeight) * fOrgGrafWidth;
+ }
+ }
+ else
+ {
+ fSclGrafWidth = fDisFrameWidth;
+ fSclGrafHeight = fDisFrameHeight;
+ }
+ }
+
+ // scaled ratio
+ double fXRatio = fSclGrafWidth / fOrgGrafWidth;
+ double fYRatio = fSclGrafHeight / fOrgGrafHeight;
+
+ // set image to scaled size.
+ pImage->SetWidth(fSclGrafWidth);
+ pImage->SetHeight(fSclGrafHeight);
+
+ // placement:centered or tiled. tiled style is not supported so it's processed together with centered.
+ if (pMyFrameLayout->GetScaleCenter() || pMyFrameLayout->GetScaleTile())
+ {
+ // set center alignment
+ xImageStyle->SetXPosType(enumXFFrameXPosCenter, enumXFFrameXRelFrame);
+ xImageStyle->SetYPosType(enumXFFrameYPosMiddle, enumXFFrameYRelFrame);
+
+ // need horizontal crop?
+ double fClipWidth = 0;
+ double fClipHeight = 0;
+ bool sal_bCropped = false;
+ if (fSclGrafWidth > fDisFrameWidth)
+ {
+ if (fXRatio == 0.0)
+ throw o3tl::divide_by_zero();
+ fClipWidth = (fSclGrafWidth-fDisFrameWidth ) / 2 / fXRatio;
+ sal_bCropped = true;
+ }
+
+ // need vertical crop?
+ if (fSclGrafHeight > fDisFrameHeight)
+ {
+ if (fYRatio == 0.0)
+ throw o3tl::divide_by_zero();
+ fClipHeight = (fSclGrafHeight-fDisFrameHeight ) / 2 / fYRatio;
+ sal_bCropped = true;
+ }
+
+ if (sal_bCropped)
+ {
+ xImageStyle->SetClip(fClipWidth, fClipWidth, fClipHeight, fClipHeight);
+ pImage->SetWidth(fDisFrameWidth);
+ pImage->SetHeight(fDisFrameHeight);
+ }
+ }
+ // placement:automatic
+ else
+ {
+ // set left-top alignment
+ xImageStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelFrame);
+ xImageStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
+
+ // get image position offset
+ LwpPoint& rOffset = pMyScale->GetOffset();
+ double fOffsetX = LwpTools::ConvertFromUnitsToMetric(rOffset.GetX());
+ double fOffsetY = LwpTools::ConvertFromUnitsToMetric(rOffset.GetY());
+
+ struct LwpRect
+ {
+ double fLeft;
+ double fRight;
+ double fTop;
+ double fBottom;
+
+ LwpRect()
+ {
+ fLeft = 0.00;
+ fRight = 0.00;
+ fTop = 0.00;
+ fBottom = 0.00;
+ }
+ LwpRect(double fL, double fR, double fT, double fB)
+ {
+ fLeft = fL;
+ fRight = fR;
+ fTop = fT;
+ fBottom = fB;
+ }
+ };
+ LwpRect aFrameRect(-fOffsetX, (fDisFrameWidth-fOffsetX), (-fOffsetY), (fDisFrameHeight-fOffsetY));
+ LwpRect aImageRect(0, fSclGrafWidth, 0, fSclGrafHeight);
+ LwpRect aCropRect;
+
+ if (aFrameRect.fRight <= aImageRect.fLeft || aFrameRect.fLeft >= aImageRect.fRight
+ ||aFrameRect.fBottom <= aImageRect.fTop|| aFrameRect.fTop >= aImageRect.fBottom)
+ {
+ // display blank
+ }
+ else// need cropped
+ {
+ // horizontal crop
+ if (aFrameRect.fLeft > aImageRect.fLeft)
+ {
+ aCropRect.fLeft = (aFrameRect.fLeft - aImageRect.fLeft) / fXRatio;
+ }
+
+ if (aFrameRect.fRight < aImageRect.fRight)
+ {
+ aCropRect.fRight = (aImageRect.fRight - aFrameRect.fRight) / fXRatio;
+ }
+
+ // vertical crop
+ if (aFrameRect.fTop > aImageRect.fTop)
+ {
+ aCropRect.fTop = (aFrameRect.fTop - aImageRect.fTop) / fYRatio;
+ }
+ if (aFrameRect.fBottom < aImageRect.fBottom)
+ {
+ aCropRect.fBottom = (aImageRect.fBottom - aFrameRect.fBottom) / fYRatio;
+ }
+
+ xImageStyle->SetClip(aCropRect.fLeft, aCropRect.fRight, aCropRect.fTop, aCropRect.fBottom);
+ double fPicWidth = fSclGrafWidth - (aCropRect.fLeft+aCropRect.fRight)*fXRatio;
+ double fPicHeight = fSclGrafHeight- (aCropRect.fTop+aCropRect.fBottom)*fYRatio;
+ double fX = fOffsetX > 0 ? fOffsetX : 0.00;
+ double fY = fOffsetY > 0 ? fOffsetY : 0.00;
+ pImage->SetPosition((fX+fLeftMargin), (fY+fTopMargin), fPicWidth, fPicHeight);
+ }
+ }
+ }
+ }
+
+ // set style for the image
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pImage->SetStyleName(pXFStyleManager->AddStyle(std::move(xImageStyle)).m_pStyle->GetStyleName());
+
+ // set anchor to frame
+ pImage->SetAnchorType(enumXFAnchorFrame);
+
+ // set object name
+ LwpAtomHolder& rHolder = GetName();
+ if ( !rHolder.str().isEmpty() )
+ {
+ pImage->SetName(rHolder.str());
+ }
+
+ // insert image object into array
+ m_vXFDrawObjects.emplace_back(pImage.get());
+
+}
+
+/**
+ * @descr Reserve the equation text in a note in the context.
+ */
+void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
+{
+ std::unique_ptr<sal_uInt8[]> pGrafData;
+ sal_uInt32 nDataLen = GetGrafData(pGrafData);
+ if(!pGrafData)
+ return;
+
+ //convert equation
+ XFParagraph* pXFPara = new XFParagraph;
+ pXFPara->Add("Formula:");
+ //add notes
+ XFAnnotation* pXFNote = new XFAnnotation;
+ //add equation to comment notes
+ XFParagraph* pXFNotePara = new XFParagraph;
+ //equation header text: Times New Roman,
+ // 18,12,0,0,0,0,0.
+ // .TCIformat{2}
+ //total head length = 45
+ bool bOk = true;
+ sal_uInt32 nBegin = 45;
+ sal_uInt32 nEnd = 0;
+ if (nDataLen >= 1)
+ nEnd = nDataLen - 1;
+ else
+ bOk = false;
+
+ if (bOk && pGrafData[nEnd] == '$' && nEnd > 0 && pGrafData[nEnd-1] != '\\')
+ {
+ //equation body is contained by '$';
+ nBegin++;
+ nEnd--;
+ }
+
+ bOk &= nEnd >= nBegin;
+ if (bOk)
+ {
+ std::unique_ptr<sal_uInt8[]> pEquData( new sal_uInt8[nEnd - nBegin + 1] );
+ for(sal_uInt32 nIndex = 0; nIndex < nEnd - nBegin +1 ; nIndex++)
+ {
+ pEquData[nIndex] = pGrafData[nBegin + nIndex];
+ }
+ pXFNotePara->Add(OUString(reinterpret_cast<char*>(pEquData.get()), (nEnd - nBegin + 1), osl_getThreadTextEncoding()));
+ }
+ pXFNote->Add(pXFNotePara);
+
+ pXFPara->Add(pXFNote);
+ pCont->Add(pXFPara);
+}
+
+void LwpGraphicObject::GetGrafOrgSize(double & rWidth, double & rHeight)
+{
+ // original image size
+ rWidth = static_cast<double>(m_Cache.Width)/TWIPS_PER_CM;
+ rHeight = static_cast<double>(m_Cache.Height)/TWIPS_PER_CM;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpgrfobj.hxx b/lotuswordpro/source/filter/lwpgrfobj.hxx
new file mode 100644
index 000000000..49e8d514b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpgrfobj.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPGRFOBJ_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPGRFOBJ_HXX
+
+#include <sal/types.h>
+#include <config_lgpl.h>
+
+#include "lwpoleobject.hxx"
+
+struct ImageProcessingData
+{
+ sal_uInt8 nBrightness;
+ sal_uInt8 nContrast;
+ sal_uInt8 nEdgeEnchancement;
+ sal_uInt8 nSmoothing;
+ bool bAutoContrast;
+ bool bInvertImage;
+
+ ImageProcessingData()
+ : nBrightness(50),
+ nContrast(50),
+ nEdgeEnchancement(0),
+ nSmoothing(0),
+ bAutoContrast(false),
+ bInvertImage(false)
+ {
+ }
+};
+
+class XFFrame;
+class LwpGraphicObject : public LwpGraphicOleObject
+{
+public:
+ LwpGraphicObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpGraphicObject() override;
+private:
+ unsigned char m_sDataFormat[AFID_MAX_FILE_FORMAT_SIZE] = {};
+ unsigned char m_sServerContextFormat[AFID_MAX_CONTEXT_FORMAT_SIZE] = {};
+ sal_Int32 m_nCachedBaseLine;
+ sal_Int16 m_bIsLinked;
+ AFID_CACHE m_Cache;
+ sal_Int16 m_bCompressed;
+ OUString m_WatermarkName;
+ OUString m_LinkedFilePath;
+
+ ImageProcessingData m_aIPData;
+
+ void XFConvertEquation(XFContentContainer* pCont);
+
+ bool IsGrafFormatValid() const;
+ std::vector< rtl::Reference<XFFrame> > m_vXFDrawObjects;
+
+public:
+ void Read() override;
+ virtual void XFConvert (XFContentContainer* pCont) override;
+ void RegisterStyle() override;
+
+ void CreateDrawObjects();
+ void CreateGrafObject();
+ static void GetBentoNamebyID(LwpObjectID const & rMyID, std::string& rName);
+ std::vector<sal_uInt8> GetRawGrafData();
+ sal_uInt32 GetGrafData(std::unique_ptr<sal_uInt8[]>& pGrafData);
+ void GetGrafOrgSize(long& rWidth, long& rHeight) { rWidth = m_Cache.Width; rHeight = m_Cache.Height; }
+ void GetGrafOrgSize(double& rWidth, double& rHeight) override;
+
+ sal_Int16 IsLinked() const { return m_bIsLinked;}
+ const OUString& GetLinkedFilePath() const { return m_LinkedFilePath;}
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpholder.cxx b/lotuswordpro/source/filter/lwpholder.cxx
new file mode 100644
index 000000000..7d6c7f415
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpholder.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpholder.hxx"
+#include <lwpfilehdr.hxx>
+
+LwpDLVListHeadHolder::LwpDLVListHeadHolder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+{}
+/**
+ * @descr read LwpDLVListHeadHolder from object stream
+*/
+void LwpDLVListHeadHolder::Read()
+{
+ m_DLVHead.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+LwpDLVListHeadTailHolder::LwpDLVListHeadTailHolder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+{}
+/**
+ * @descr read LwpDLVListHeadTailHolder from object stream
+*/
+void LwpDLVListHeadTailHolder::Read()
+{
+ m_HeadTail.Read(m_pObjStrm.get());
+ //m_pObjStrm->SkipExtra();
+}
+
+LwpObjectHolder::LwpObjectHolder(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpDLVList(objHdr, pStrm)
+{}
+/**
+ * @descr read LwpObjectHolder from object stream
+*/
+void LwpObjectHolder::Read()
+{
+ LwpDLVList::Read();
+
+ m_Object.ReadIndexed(m_pObjStrm.get());
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ m_pObjStrm->SkipExtra();
+}
+
+LwpListList::LwpListList(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ :LwpObjectHolder(objHdr, pStrm)
+{}
+/**
+ * @descr read LwpListList from object stream
+*/
+void LwpListList::Read()
+{
+ LwpObjectHolder::Read();
+
+ m_HeadTail.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpholder.hxx b/lotuswordpro/source/filter/lwpholder.hxx
new file mode 100644
index 000000000..2b5bbc2ac
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpholder.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * kinds of holder classes header file
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPHOLDER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPHOLDER_HXX
+
+#include <lwpobj.hxx>
+#include "lwpdlvlist.hxx"
+/**
+ * @brief VO_HEADHOLDER, LwpDLVListHeadHolder,
+ * contains an id to the head of LwpDLVList
+*/
+class LwpDLVListHeadHolder : public LwpObject
+{
+public:
+ LwpDLVListHeadHolder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ LwpObjectID& GetHeadID() { return m_DLVHead;}
+private:
+ virtual ~LwpDLVListHeadHolder() override {}
+
+ LwpObjectID m_DLVHead;
+};
+/**
+ * @brief VO_HEADTAILHOLDER, LwpDLVListHeadTailHolder,
+ * contains a LwpDLVListHeadTail (Head and tail id)
+*/
+class LwpDLVListHeadTailHolder final : public LwpObject
+{
+public:
+ LwpDLVListHeadTailHolder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ LwpObjectID& GetHead(){ return m_HeadTail.GetHead();}
+ LwpObjectID& GetTail(){ return m_HeadTail.GetTail();}
+private:
+ virtual ~LwpDLVListHeadTailHolder() override {}
+
+ LwpDLVListHeadTail m_HeadTail;
+};
+/**
+ * @brief LwpObjectHolder, which is LwpDLVList, contains an id to an object
+ * VO_OBJECTHOLDER
+*/
+class LwpObjectHolder : public LwpDLVList
+{
+public:
+ LwpObjectHolder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ LwpObjectID& GetObject() { return m_Object; }
+protected:
+ virtual ~LwpObjectHolder() override {}
+private:
+ LwpObjectID m_Object;
+};
+
+/**
+ * @brief VO_LISTLIST object in .lwp file
+ *
+ */
+class LwpListList final : public LwpObjectHolder
+{
+public:
+ LwpListList(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ LwpObjectID& GetHead(){ return m_HeadTail.GetHead();}
+private:
+ virtual ~LwpListList() override {}
+
+ LwpDLVListHeadTail m_HeadTail;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwphyperlinkmgr.cxx b/lotuswordpro/source/filter/lwphyperlinkmgr.cxx
new file mode 100644
index 000000000..bd8680ead
--- /dev/null
+++ b/lotuswordpro/source/filter/lwphyperlinkmgr.cxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwphyperlinkmgr.hxx"
+
+LwpHyperlinkMgr::LwpHyperlinkMgr()
+{
+ m_bIsHyperlink = false;
+}
+
+LwpHyperlinkMgr::~LwpHyperlinkMgr()
+{
+}
+
+
+void LwpHyperlinkMgr::SetHyperlink(const OUString& hyperlink)
+{
+ m_Hyperlink = hyperlink;
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwphyperlinkmgr.hxx b/lotuswordpro/source/filter/lwphyperlinkmgr.hxx
new file mode 100644
index 000000000..5eab1cc92
--- /dev/null
+++ b/lotuswordpro/source/filter/lwphyperlinkmgr.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPHYPERLINKMGR_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPHYPERLINKMGR_HXX
+
+#include <rtl/ustring.hxx>
+
+class LwpHyperlinkMgr
+{
+public:
+ LwpHyperlinkMgr();
+ ~LwpHyperlinkMgr();
+ void SetHyperlinkFlag(bool bFlag) { m_bIsHyperlink = bFlag; }
+ bool GetHyperlinkFlag() const { return m_bIsHyperlink; }
+ void SetHyperlink(const OUString& hyperlink);
+ const OUString& GetHyperlink() const { return m_Hyperlink; }
+
+private:
+ OUString m_Hyperlink;
+ bool m_bIsHyperlink;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx
new file mode 100644
index 000000000..26042fc96
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpidxmgr.cxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**********************************************************************************************************************
+ * @file
+ * index manager implementation
+ * Three record types are related with index information, and two ways are used.
+* 1. VO_ROOTOBJINDEX works with one or more VO_LEAFOBJINDEX records to
+* provide the map of all object ids and their offsets.
+* VO_ROOTOBJINDEX includes k (object id, offset) and timetable which is used to map index to actual low id
+ * 2. VO_ROOTLEAFOBJINDEX is used when the file is so small that the number of objects is less than 256(?)
+ * VO_ROOTLEAFOBJINDEX contains directly the (object id, offset) map and time table.
+
+**********************************************************************************************************************/
+
+#include <lwpidxmgr.hxx>
+#include <lwpobjhdr.hxx>
+#include <lwptools.hxx>
+#include <memory>
+
+const sal_uInt8 LwpIndexManager::MAXOBJECTIDS = 255;
+
+LwpIndexManager::LwpIndexManager()
+ : m_nKeyCount(0)
+ , m_nLeafCount(0)
+{
+ m_TempVec.resize( LwpIndexManager::MAXOBJECTIDS );
+
+}
+
+/**
+ * @descr Read all index records, VO_ROOTLEAFOBJINDEX, VO_ROOTOBJINDEX, VO_LEAFOBJINDEX
+ */
+void LwpIndexManager::Read(LwpSvStream* pStrm)
+{
+ //Read index obj
+ LwpObjectHeader ObjHdr;
+ ObjHdr.Read(*pStrm);
+ std::unique_ptr<LwpObjectStream> xObjStrm(new LwpObjectStream(pStrm, ObjHdr.IsCompressed(),
+ static_cast<sal_uInt16>(ObjHdr.GetSize())));
+
+ if( ObjHdr.GetTag() == VO_ROOTLEAFOBJINDEX )
+ {
+ ReadLeafData(xObjStrm.get());
+ ReadTimeTable(xObjStrm.get());
+ xObjStrm.reset();
+ }
+ else
+ {
+ ReadRootData(xObjStrm.get());
+ xObjStrm.reset();
+
+ for (sal_uInt16 k = 0; k < m_nLeafCount; k++)
+ {
+ //Read leaf
+ sal_Int64 nPos = m_ChildIndex[k]+LwpSvStream::LWP_STREAM_BASE;
+ sal_Int64 nActualPos = pStrm->Seek(nPos);
+
+ if (nPos != nActualPos)
+ throw BadSeek();
+
+ //Old Code
+ //ReadLeafIndex(pStrm);
+ //New Code
+ ReadObjIndex( pStrm );
+
+ //Read object in root, these objects are between the leaf objects
+ if(k!=m_nLeafCount-1)
+ {
+ m_ObjectKeys.push_back(m_RootObjs[k]);
+ m_nKeyCount ++;
+ }
+ }
+ m_RootObjs.clear();
+ }
+}
+
+/**
+ * @descr Read data in VO_ROOTOBJINDEX
+ */
+void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm)
+{
+
+ sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16();
+ m_nLeafCount = KeyCount ? KeyCount + 1 : 0;
+
+ if (m_nLeafCount > SAL_N_ELEMENTS(m_ChildIndex))
+ throw std::range_error("corrupt RootData");
+
+ if (KeyCount)
+ {
+ //read object keys
+ LwpKey akey;
+ akey.id.Read(pObjStrm);
+ m_RootObjs.push_back(akey);
+
+ sal_uInt16 k = 0;
+
+ for (k = 1; k < KeyCount; k++)
+ {
+ akey.id.ReadCompressed(pObjStrm, m_RootObjs[k-1].id);
+ m_RootObjs.push_back(akey);
+ }
+
+ for (k = 0; k < KeyCount; k++)
+ m_RootObjs[k].offset = pObjStrm->QuickReaduInt32();
+
+ //read leaf index offset
+ for (k = 0; k < m_nLeafCount; k++)
+ m_ChildIndex[k] = pObjStrm->QuickReaduInt32();
+ }
+
+ ReadTimeTable(pObjStrm);
+
+}
+
+//Add new method to handle ObjIndex data
+/**
+ * @descr Read data in VO_OBJINDEX
+ */
+void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm)
+{
+ sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16();
+ sal_uInt16 LeafCount = KeyCount + 1;
+
+ std::vector<LwpKey> vObjIndexs;
+
+ if (KeyCount)
+ {
+ LwpKey akey;
+ akey.id.Read(pObjStrm);
+ vObjIndexs.push_back(akey);
+
+ sal_uInt16 k = 0;
+
+ for (k = 1; k < KeyCount; k++)
+ {
+ akey.id.ReadCompressed(pObjStrm, vObjIndexs[k-1].id);
+ vObjIndexs.push_back(akey);
+ }
+
+ for (k = 0; k < KeyCount; k++)
+ vObjIndexs[k].offset = pObjStrm->QuickReaduInt32();
+
+ for (k = 0; k < LeafCount; k++)
+ m_TempVec.at(k) = pObjStrm->QuickReaduInt32();
+ }
+
+ for( sal_uInt16 j=0; j<LeafCount; j++ )
+ {
+ sal_Int64 nPos = m_TempVec.at(j) + LwpSvStream::LWP_STREAM_BASE;
+ sal_Int64 nActualPos = pObjStrm->GetStream()->Seek(nPos);
+
+ if (nPos != nActualPos)
+ throw BadSeek();
+
+ ReadLeafIndex(pObjStrm->GetStream());
+
+ if(j!=LeafCount-1)
+ {
+ m_ObjectKeys.push_back(vObjIndexs[j]);
+
+ m_nKeyCount ++;
+ }
+ }
+
+ vObjIndexs.clear();
+ m_TempVec.clear();
+}
+
+/**
+ * @descr Read VO_OBJINDEX
+ */
+void LwpIndexManager::ReadObjIndex( LwpSvStream *pStrm )
+{
+
+ LwpObjectHeader ObjHdr;
+ ObjHdr.Read(*pStrm);
+ std::unique_ptr<LwpObjectStream> pObjStrm( new LwpObjectStream(pStrm, ObjHdr.IsCompressed(),
+ static_cast<sal_uInt16>(ObjHdr.GetSize()) ) );
+
+ if( sal_uInt32(VO_OBJINDEX) == ObjHdr.GetTag() )
+ {
+ ReadObjIndexData( pObjStrm.get() );
+ }
+ else if( sal_uInt32(VO_LEAFOBJINDEX) == ObjHdr.GetTag() )
+ {
+ ReadLeafData( pObjStrm.get() );
+ }
+}
+
+/**
+ * @descr Read VO_LEAFOBJINDEX
+ */
+void LwpIndexManager::ReadLeafIndex( LwpSvStream *pStrm )
+{
+ LwpObjectHeader ObjHdr;
+ ObjHdr.Read(*pStrm);
+ std::unique_ptr<LwpObjectStream> pObjStrm( new LwpObjectStream(pStrm, ObjHdr.IsCompressed(),
+ static_cast<sal_uInt16>(ObjHdr.GetSize()) ) );
+
+ ReadLeafData(pObjStrm.get());
+}
+/**
+ * @descr Read data in VO_LEAFOBJINDEX
+ */
+void LwpIndexManager::ReadLeafData( LwpObjectStream *pObjStrm )
+{
+ sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16();
+
+ if(KeyCount)
+ {
+ LwpKey akey;
+ //read object keys: id & offset
+ akey.id.Read(pObjStrm);
+ m_ObjectKeys.push_back(akey);
+
+ for (sal_uInt16 k = 1; k < KeyCount; k++)
+ {
+ akey.id.ReadCompressed(pObjStrm, m_ObjectKeys.at(m_nKeyCount+k-1).id);
+ m_ObjectKeys.push_back(akey);
+ }
+
+ for (sal_uInt16 j = 0; j < KeyCount; j++)
+ m_ObjectKeys.at(m_nKeyCount+j).offset = pObjStrm->QuickReaduInt32();
+ }
+ m_nKeyCount += KeyCount;
+}
+/**
+ * @descr Read time table in VO_ROOTLEAFOBJINDEX and VO_ROOTOBJINDEX
+ */
+void LwpIndexManager::ReadTimeTable(LwpObjectStream *pObjStrm)
+{
+ sal_uInt16 nTimeCount = pObjStrm->QuickReaduInt16();
+
+ for(sal_uInt16 i=0; i<nTimeCount; ++i)
+ {
+ sal_uInt32 atime = pObjStrm->QuickReaduInt32();
+ m_TimeTable.push_back(atime);
+ }
+}
+/**
+ * @descr get object offset per the object id
+ */
+sal_uInt32 LwpIndexManager::GetObjOffset( LwpObjectID objid )
+{
+
+ //sal_uInt16 L, U, M;
+ sal_uInt32 L, U, M;
+
+ L = 0;
+ U = m_nKeyCount;
+ while (L != U)
+ {
+ M = (L + U) >> 1;
+
+ if (objid.GetLow() > m_ObjectKeys[M].id.GetLow())
+ L = M + 1;
+ else if (objid.GetLow() < m_ObjectKeys[M].id.GetLow())
+ U = M;
+ else if (objid.GetHigh() > m_ObjectKeys[M].id.GetHigh())
+ L = M + 1;
+ else if (objid.GetHigh() < m_ObjectKeys[M].id.GetHigh())
+ U = M;
+ else
+ {
+ return(m_ObjectKeys[M].offset);
+ }
+ }
+ return BAD_OFFSET;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
new file mode 100644
index 000000000..c68f1326e
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -0,0 +1,2145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+#include "lwplayout.hxx"
+#include "lwpusewhen.hxx"
+#include <lwptools.hxx>
+#include "lwplaypiece.hxx"
+#include <xfilter/xfcolumns.hxx>
+#include "lwpstory.hxx"
+#include "lwpparastyle.hxx"
+#include "lwpholder.hxx"
+#include "lwpdoc.hxx"
+#include "lwppagehint.hxx"
+#include "lwpdivinfo.hxx"
+#include "lwpgrfobj.hxx"
+#include <lwpfilehdr.hxx>
+#include <osl/thread.h>
+#include <sal/log.hxx>
+#include <o3tl/sorted_vector.hxx>
+
+LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLNFPVList(objHdr, pStrm)
+ , m_bGettingHonorProtection(false)
+ , m_bGettingMarginsSameAsParent(false)
+ , m_bGettingHasProtection(false)
+ , m_bGettingIsProtected(false)
+ , m_bGettingIsAutoGrowDown(false)
+ , m_bGettingMarginsValue(false)
+ , m_bGettingExtMarginsValue(false)
+ , m_bGettingUsePrinterSettings(false)
+ , m_bGettingScaleCenter(false)
+ , m_bGettingBorderStuff(false)
+ , m_bGettingUseWhen(false)
+ , m_bGettingStyleLayout(false)
+ , m_bGettingAutoGrowUp(false)
+ , m_nAttributes(0)
+ , m_nAttributes2(0)
+ , m_nAttributes3(0)
+ , m_nOverrideFlag(0)
+ , m_nDirection(0)
+ , m_nEditorID(0)
+{
+}
+
+void LwpVirtualLayout::Read()
+{
+ LwpDLNFPVList::Read();
+
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+ m_nAttributes = pStrm->QuickReaduInt32();
+ m_nAttributes2 = pStrm->QuickReaduInt32();
+ m_nAttributes3 = pStrm->QuickReaduInt32();
+ m_nOverrideFlag = pStrm->QuickReaduInt32();
+ m_nDirection = pStrm->QuickReaduInt16();
+
+ //Note that two bytes is read into m_nEditorID instead of one byte.
+ m_nEditorID = pStrm->QuickReaduInt16();
+
+ m_NextEnumerated.ReadIndexed(pStrm);
+ m_PreviousEnumerated.ReadIndexed(pStrm);
+
+ pStrm->SkipExtra();
+}
+
+bool LwpVirtualLayout::MarginsSameAsParent()
+{
+ return (m_nAttributes2 & STYLE2_MARGINSSAMEASPARENT) != 0;
+}
+
+/**
+* @descr: Get the gap between columns
+*
+*/
+double LwpVirtualLayout::GetColGap(sal_uInt16 /*nIndex*/)
+{
+ //return DEFAULTGAPSIZE;
+ //return LwpTools::ConvertToMetric(0.17);//DEFAULTGAPSIZE=0.17
+ return LwpTools::ConvertToMetric(0.17);
+}
+
+/**
+* @descr: Whether it is honoring protection
+*
+*/
+bool LwpVirtualLayout::HonorProtection()
+{
+ if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
+ return false;
+
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
+ {
+ return xParent->GetHonorProtection();
+ }
+
+ if(m_pFoundry)//is null now
+ {
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ if(pDoc && pDoc->GetRootDocument())
+ return pDoc->GetRootDocument()->GetHonorProtection();
+ }
+
+ return true;
+}
+
+/**
+* @descr: Whether it is protected
+*
+*/
+bool LwpVirtualLayout::IsProtected()
+{
+ bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
+
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
+ {
+ if (xParent->GetHonorProtection() && (xParent->GetHasProtection()||bProtected))
+ {
+ return true;
+ }
+ }
+ else if(m_pFoundry)//is null now
+ {
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ if(pDoc)
+ {
+ if (pDoc->GetHonorProtection() && bProtected)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
+* @descr: Whether it has protection
+*
+*/
+bool LwpVirtualLayout::HasProtection()
+{
+ if(m_nAttributes & STYLE_PROTECTED)
+ return true;
+
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
+ {
+ return xParent->GetHasProtection();
+ }
+
+ return false;
+}
+
+/**
+* @descr: Whether it is a mirror layout
+*
+*/
+bool LwpVirtualLayout::IsComplex() const
+{
+ return (m_nAttributes & STYLE_COMPLEX) != 0;
+}
+
+/**
+* @descr: Get usewhen pointer
+*
+*/
+LwpUseWhen* LwpVirtualLayout::GetUseWhen()
+{
+ if (m_bGettingUseWhen)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingUseWhen= true;
+
+ LwpUseWhen* pRet = nullptr;
+
+ /*
+ If we have a parent, and I'm not a page layout,
+ use my parents information.
+ */
+ if(GetLayoutType()!=LWP_PAGE_LAYOUT)
+ {
+ //get parent
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader() && (xParent->GetLayoutType() != LWP_PAGE_LAYOUT))
+ pRet = xParent->GetUseWhen();
+
+ }
+
+ if (!pRet)
+ pRet = VirtualGetUseWhen();
+
+ m_bGettingUseWhen = false;
+
+ return pRet;
+}
+/**
+ * @descr: Whether this layout is page layout or not
+*/
+bool LwpVirtualLayout::IsPage()
+{
+ return (GetLayoutType() == LWP_PAGE_LAYOUT);
+}
+/**
+ * @descr: Whether this layout is header layout or not
+*/
+bool LwpVirtualLayout::IsHeader()
+{
+ return (GetLayoutType() == LWP_HEADER_LAYOUT);
+}
+/**
+ * @descr: Whether this layout is footer layout or not
+*/
+bool LwpVirtualLayout::IsFooter()
+{
+ return (GetLayoutType() == LWP_FOOTER_LAYOUT);
+}
+/**
+ * @descr: Whether this layout is frame layout or not
+*/
+bool LwpVirtualLayout::IsFrame()
+{
+ return (GetLayoutType() == LWP_FRAME_LAYOUT);
+}
+
+/**
+ * @descr: Whether this layout is cell layout or not
+*/
+bool LwpVirtualLayout::IsCell()
+{
+ return (GetLayoutType() == LWP_CELL_LAYOUT
+ || GetLayoutType() == LWP_CONNECTED_CELL_LAYOUT
+ || GetLayoutType() == LWP_HIDDEN_CELL_LAYOUT);
+}
+/**
+ * @descr: Whether this layout is supertable layout or not
+*/
+bool LwpVirtualLayout::IsSuperTable()
+{
+ return (GetLayoutType() == LWP_SUPERTABLE_LAYOUT);
+}
+/**
+ * @descr: Whether this layout is group layout or not
+*/
+bool LwpVirtualLayout::IsGroupHead()
+{
+ return (GetLayoutType() == LWP_GROUP_LAYOUT);
+}
+/**
+ * @descr: get the relative type
+*/
+sal_uInt8 LwpVirtualLayout::GetRelativeType()
+{
+ return LwpLayoutRelativityGuts::LAY_PARENT_RELATIVE;
+}
+/**
+ * @descr: whether it is relative anchored layout
+*/
+bool LwpVirtualLayout::IsRelativeAnchored()
+{
+ sal_uInt8 nType;
+
+ nType = GetRelativeType();
+ return (nType == LwpLayoutRelativityGuts::LAY_PARA_RELATIVE) || (nType == LwpLayoutRelativityGuts::LAY_INLINE)
+ || (nType == LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE) || (nType == LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL);
+}
+/**
+ * @descr: whether it is MinimumHeight layout
+*/
+bool LwpVirtualLayout::IsMinimumHeight() const
+{
+ return ((m_nAttributes3& STYLE3_MINHEIGHTVALID) != 0);
+}
+
+/**
+* @descr: Get parent layout
+*
+*/
+rtl::Reference<LwpVirtualLayout> LwpVirtualLayout::GetParentLayout()
+{
+ return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+}
+
+/**
+* @descr: Register child layout style
+*
+*/
+void LwpVirtualLayout::RegisterChildStyle()
+{
+ //Register all children styles
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLayout.is())
+ {
+ xLayout->SetFoundry(m_pFoundry);
+ xLayout->DoRegisterStyle();
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
+ }
+}
+
+bool LwpVirtualLayout::NoContentReference()
+{
+ return (m_nAttributes2 & STYLE2_NOCONTENTREFERENCE) != 0;
+}
+
+bool LwpVirtualLayout::IsStyleLayout()
+{
+ if (m_bGettingStyleLayout)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingStyleLayout = true;
+
+ bool bRet = false;
+ if (m_nAttributes3 & STYLE3_STYLELAYOUT)
+ bRet = true;
+ else
+ {
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is())
+ bRet = xParent->IsStyleLayout();
+ }
+
+ m_bGettingStyleLayout = false;
+ return bRet;
+}
+
+/**
+* @descr: Find child layout by layout type
+*
+*/
+LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
+{
+ LwpObjectID *pID = &GetChildHead();
+ LwpVirtualLayout* pPrevLayout = nullptr;
+
+ while(pID && !pID->IsNull())
+ {
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
+ if (!pLayout)
+ break;
+
+ if (pPrevLayout && pLayout == pPrevLayout)
+ {
+ SAL_WARN("lwp", "loop in layout");
+ break;
+ }
+
+ pPrevLayout = pLayout;
+
+ if (pLayout->GetLayoutType() == eType)
+ return pLayout;
+
+ pID = &pLayout->GetNext();
+ }
+
+ return nullptr;
+}
+
+/**
+* @descr: Whether the size of layout is fit the graphic
+*
+*/
+bool LwpVirtualLayout::IsFitGraphic()
+{
+ return IsAutoGrowRight() && !IsAutoGrowLeft() && GetIsAutoGrowDown();
+}
+
+/**
+* @descr: Whether the width of layout is auto grow
+*
+*/
+bool LwpVirtualLayout::IsAutoGrowWidth()
+{
+ return IsAutoGrowLeft() || IsAutoGrowRight();
+}
+
+/**
+* @descr: Determine whether the layout width is to margin
+*
+*/
+bool LwpVirtualLayout::IsInlineToMargin() const
+{
+ return (m_nAttributes3 & STYLE3_INLINETOMARGIN) != 0;
+}
+
+void LwpAssociatedLayouts::Read(LwpObjectStream* pStrm)
+{
+ m_OnlyLayout.ReadIndexed(pStrm);
+ m_Layouts.Read(pStrm);
+ pStrm->SkipExtra();
+}
+
+/**
+* @descr: Looking for the layout which follows the pStartLayout
+* @param: pStartLayout - the layout which is used for looking for its following layout
+*/
+rtl::Reference<LwpVirtualLayout> LwpAssociatedLayouts::GetLayout(LwpVirtualLayout const *pStartLayout)
+{
+ if (!pStartLayout && !m_OnlyLayout.IsNull())
+ /* Looking for the first layout and there's only one layout in the list.*/
+ return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj().get()));
+
+ rtl::Reference<LwpObjectHolder> xObjHolder(dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead().obj().get()));
+ if (xObjHolder.is())
+ {
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ if (!pStartLayout)
+ return xLayout;
+
+ while (xObjHolder.is() && pStartLayout != xLayout.get())
+ {
+ xObjHolder.set(dynamic_cast<LwpObjectHolder*>(xObjHolder->GetNext().obj().get()));
+ if (xObjHolder.is())
+ {
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ }
+ }
+
+ if (xObjHolder.is())
+ {
+ xObjHolder.set(dynamic_cast<LwpObjectHolder*>(xObjHolder->GetNext().obj().get()));
+ if (xObjHolder.is())
+ {
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ return xLayout;
+ }
+ }
+ }
+
+ return rtl::Reference<LwpVirtualLayout>();
+}
+
+LwpHeadLayout::LwpHeadLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpVirtualLayout(objHdr, pStrm)
+{}
+
+void LwpHeadLayout::Read()
+{
+ LwpVirtualLayout::Read();
+ //For PermissiveLayout
+ m_pObjStrm->SkipExtra();
+ //For me
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpHeadLayout::RegisterStyle()
+{
+ //Register all children styles
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
+ while (xLayout.is())
+ {
+ aSeen.insert(xLayout.get());
+ xLayout->SetFoundry(m_pFoundry);
+ //if the layout is relative to para, the layout will be registered in para
+ if (!xLayout->IsRelativeAnchored())
+ xLayout->DoRegisterStyle();
+ rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
+ if (aSeen.find(xNext.get()) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ xLayout = xNext;
+ }
+}
+
+/**
+ * @descr find endnote supertable layout from the child layout list. Suppose that there is only one endnote supertablelayout in one division
+ * @return pointer to endnote supertable layout
+ */
+rtl::Reference<LwpVirtualLayout> LwpHeadLayout::FindEnSuperTableLayout()
+{
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
+ while (xLayout)
+ {
+ aSeen.insert(xLayout.get());
+ if (xLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT)
+ {
+ return xLayout;
+ }
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
+ if (aSeen.find(xLayout.get()) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ return rtl::Reference<LwpVirtualLayout>();
+}
+
+LwpLayoutStyle::LwpLayoutStyle()
+ : m_nStyleDefinition(0)
+ , m_pDescription(new LwpAtomHolder)
+ , m_nKey(0)
+{
+}
+
+LwpLayoutStyle::~LwpLayoutStyle()
+{
+}
+
+void LwpLayoutStyle::Read(LwpObjectStream* pStrm)
+{
+ m_nStyleDefinition = pStrm->QuickReaduInt32();
+ m_pDescription->Read(pStrm);
+ if (pStrm->CheckExtra())
+ {
+ m_nKey = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+ }
+}
+
+LwpLayoutMisc::LwpLayoutMisc() :
+m_nGridDistance(0), m_nGridType(0)
+{
+}
+
+LwpLayoutMisc::~LwpLayoutMisc()
+{
+}
+
+void LwpLayoutMisc::Read(LwpObjectStream* pStrm)
+{
+ m_nGridType = pStrm->QuickReaduInt16();
+ m_nGridDistance = pStrm->QuickReadInt32();
+ m_aContentStyle.Read(pStrm);
+ pStrm->SkipExtra();
+}
+
+LwpMiddleLayout::LwpMiddleLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm )
+ : LwpVirtualLayout(objHdr, pStrm)
+ , m_bGettingGeometry(false)
+ , m_bGettingBackgroundStuff(false)
+{
+}
+
+LwpMiddleLayout::~LwpMiddleLayout()
+{
+}
+
+void LwpMiddleLayout::Read()
+{
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+
+ LwpVirtualLayout::Read();
+
+ //skip CLiteLayout data;
+ LwpAtomHolder ContentClass;
+ ContentClass.Read(pStrm);
+ pStrm->SkipExtra();
+
+ // before layout hierarchy rework
+ if(LwpFileHeader::m_nFileRevision < 0x000B)
+ return;
+
+ m_Content.ReadIndexed(pStrm);
+
+ // 01/20/2005
+ m_BasedOnStyle.ReadIndexed(pStrm);
+ m_TabPiece.ReadIndexed(pStrm);
+
+ sal_uInt8 nWhatsItGot = pStrm->QuickReaduInt8();
+
+ if (nWhatsItGot & DISK_GOT_STYLE_STUFF)
+ {
+ m_aStyleStuff.Read(pStrm);
+ }
+ if (nWhatsItGot & DISK_GOT_MISC_STUFF)
+ {
+ m_aMiscStuff.Read(pStrm);
+ }
+
+ m_LayGeometry.ReadIndexed(pStrm);
+ m_LayScale.ReadIndexed(pStrm);
+ m_LayMargins.ReadIndexed(pStrm);
+ m_LayBorderStuff.ReadIndexed(pStrm);
+ m_LayBackgroundStuff.ReadIndexed(pStrm);
+
+ if (pStrm->CheckExtra())
+ {
+ m_LayExtBorderStuff.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+ }
+}
+
+rtl::Reference<LwpObject> LwpMiddleLayout::GetBasedOnStyle() const
+{
+ rtl::Reference<LwpObject> xRet(m_BasedOnStyle.obj());
+ if (xRet.get() == this)
+ {
+ SAL_WARN("lwp", "style based on itself");
+ return rtl::Reference<LwpObject>();
+ }
+ return xRet;
+}
+
+/**
+* @descr: Get the geometry of current layout
+*
+*/
+LwpLayoutGeometry* LwpMiddleLayout::GetGeometry()
+{
+ if (m_bGettingGeometry)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingGeometry = true;
+
+ LwpLayoutGeometry* pRet = nullptr;
+ if( !m_LayGeometry.IsNull() )
+ {
+ pRet = dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj().get());
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ pRet = pLay->GetGeometry();
+ }
+ }
+
+ m_bGettingGeometry = false;
+ return pRet;
+}
+
+/**
+* @descr: Get layout height, measured by "cm"
+*
+*/
+double LwpMiddleLayout::GetGeometryHeight()
+{
+ LwpLayoutGeometry* pGeo = GetGeometry();
+ if(pGeo)
+ {
+ return LwpTools::ConvertFromUnitsToMetric( pGeo->GetHeight() );
+ }
+ else
+ return -1;
+}
+
+/**
+* @descr: Get layout width, measured by "cm"
+*
+*/
+double LwpMiddleLayout::GetGeometryWidth()
+{
+ LwpLayoutGeometry* pGeo = GetGeometry();
+ if(pGeo)
+ {
+ return LwpTools::ConvertFromUnitsToMetric( pGeo->GetWidth() );
+ }
+ else
+ return -1;
+}
+
+/**
+* @descr: Whether the margins is same as parent layout
+*
+*/
+bool LwpMiddleLayout::MarginsSameAsParent()
+{
+ if(m_nOverrideFlag & OVER_MARGINS)
+ {
+ return LwpVirtualLayout::MarginsSameAsParent();
+ }
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(xBase.get()))
+ {
+ pLay->GetMarginsSameAsParent();
+ }
+ return LwpVirtualLayout::MarginsSameAsParent();
+}
+
+/**
+* @descr: Get margin
+* @param: nWhichSide - 0: left, 1: right, 2:top, 3: bottom
+*/
+double LwpMiddleLayout::MarginsValue(sal_uInt8 nWhichSide)
+{
+ double fValue = 0;
+ if((nWhichSide==MARGIN_LEFT)||(nWhichSide==MARGIN_RIGHT))
+ {
+ if ( GetMarginsSameAsParent() )
+ {
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
+ {
+ fValue = xParent->GetMarginsValue(nWhichSide);
+ return fValue;
+ }
+ }
+ }
+
+ if(m_nOverrideFlag & OVER_MARGINS)
+ {
+ LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj().get());
+ if(pMar1)
+ {
+ fValue = pMar1->GetMargins().GetMarginsValue(nWhichSide);
+ return fValue;
+ }
+ }
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
+ if (pStyle)
+ {
+ fValue = pStyle->GetMarginsValue(nWhichSide);
+ return fValue;
+ }
+ return LwpVirtualLayout::MarginsValue(nWhichSide);
+}
+/**
+ * @descr: Get extmargin value
+ * @param: nWhichSide - 0: left, 1: right, 2:top, 3: bottom
+ * @param:
+ * @return:
+*/
+double LwpMiddleLayout::ExtMarginsValue(sal_uInt8 nWhichSide)
+{
+ double fValue = 0;
+ if(m_nOverrideFlag & OVER_MARGINS)
+ {
+ LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj().get());
+ if(pMar1)
+ {
+ fValue = pMar1->GetExtMargins().GetMarginsValue(nWhichSide);
+ return fValue;
+ }
+ }
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get());
+ if(pStyle)
+ {
+ fValue = pStyle->GetExtMarginsValue(nWhichSide);
+ return fValue;
+ }
+ return LwpVirtualLayout::ExtMarginsValue(nWhichSide);
+}
+/**
+ * @descr: Get the LwpBorderStuff object according to m_LayBorderStuff id.
+*/
+LwpBorderStuff* LwpMiddleLayout::GetBorderStuff()
+{
+ if (m_bGettingBorderStuff)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingBorderStuff = true;
+
+ LwpBorderStuff* pRet = nullptr;
+
+ if(m_nOverrideFlag & OVER_BORDERS)
+ {
+ LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj().get());
+ pRet = pLayoutBorder ? &pLayoutBorder->GetBorderStuff() : nullptr;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ pRet = pLay->GetBorderStuff();
+ }
+ }
+
+ m_bGettingBorderStuff= false;
+ return pRet;
+}
+
+/**
+ * @descr: Get LwpBackgroundStuff object according to m_LayBackgroundStuff id;
+*/
+LwpBackgroundStuff* LwpMiddleLayout::GetBackgroundStuff()
+{
+ if (m_bGettingBackgroundStuff)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingBackgroundStuff = true;
+
+ LwpBackgroundStuff* pRet = nullptr;
+
+ if(m_nOverrideFlag & OVER_BACKGROUND)
+ {
+ LwpLayoutBackground* pLayoutBackground = dynamic_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj().get());
+ pRet = pLayoutBackground ? &pLayoutBackground->GetBackgoudStuff() : nullptr;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ pRet = pLay->GetBackgroundStuff();
+ }
+ }
+
+ m_bGettingBackgroundStuff = false;
+ return pRet;
+}
+
+/**
+ * @descr: create xfborder.
+*/
+std::unique_ptr<XFBorders> LwpMiddleLayout::GetXFBorders()
+{
+ LwpBorderStuff* pBorderStuff = GetBorderStuff();
+ if(pBorderStuff&&pBorderStuff->GetSide() != 0)
+ {
+ //copy from lwpparastyle.
+ std::unique_ptr<XFBorders> xXFBorders(new XFBorders);
+ // apply 4 borders respectively
+ LwpBorderStuff::BorderType const pType[] = { LwpBorderStuff::LEFT, LwpBorderStuff::RIGHT,
+ LwpBorderStuff::TOP, LwpBorderStuff::BOTTOM };
+
+ for (LwpBorderStuff::BorderType nC : pType)
+ {
+ if (pBorderStuff->HasSide(nC))
+ {
+ LwpParaStyle::ApplySubBorder(pBorderStuff, nC, xXFBorders.get());
+ }
+ }
+ return xXFBorders;
+ }
+ return nullptr;
+}
+
+/**
+ * @descr: Get text direction settings.
+*/
+enumXFTextDir LwpMiddleLayout::GetTextDirection()
+{
+ enumXFTextDir eTextDir = enumXFTextDirNone;
+ sal_uInt8 nDirection = GetContentOrientation();
+ switch(nDirection)
+ {
+ case TEXT_ORIENT_LRTB:
+ {
+ eTextDir = enumXFTextDirLR_TB;
+ break;
+ }
+ case TEXT_ORIENT_TBRL:
+ {
+ eTextDir = enumXFTextDirTB_RL;
+ break;
+ }
+ case TEXT_ORIENT_RLBT: // not supported now
+ {
+ eTextDir = enumXFTextDirNone;
+ break;
+ }
+ case TEXT_ORIENT_BTLR: // not supported now
+ {
+ eTextDir = enumXFTextDirNone;
+ break;
+ }
+ default:
+ break;
+ }
+ return eTextDir;
+}
+/**
+ * @descr: Get background color.
+*/
+LwpColor* LwpMiddleLayout::GetBackColor()
+{
+ LwpBackgroundStuff* pBackgroundStuff = GetBackgroundStuff();
+ if(pBackgroundStuff && !pBackgroundStuff->IsTransparent())
+ {
+ LwpColor* pColor = pBackgroundStuff->GetFillColor();
+ if(pColor->IsValidColor())
+ {
+ return pColor;
+ }
+ }
+ return nullptr;
+}
+
+/**
+ * @descr: Add back color settings into xfpagemaster.
+*/
+LwpTabOverride* LwpMiddleLayout::GetTabOverride()
+{
+ if(m_nAttributes & OVER_TABS)
+ {
+ if(!m_TabPiece.IsNull())
+ {
+ LwpTabPiece *pPiece = dynamic_cast<LwpTabPiece*>(m_TabPiece.obj().get());
+ return static_cast<LwpTabOverride*>(pPiece ? pPiece->GetOverride() : nullptr);
+ }
+ return nullptr;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetTabOverride();
+ }
+ }
+ return nullptr;
+}
+
+/**
+ * @descr: Layscale for graphic & watermark
+*/
+sal_uInt16 LwpMiddleLayout::GetScaleMode()
+{
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
+ return GetLayoutScale()->GetScaleMode();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (xBase.is())
+ return dynamic_cast<LwpMiddleLayout&>(*xBase).GetScaleMode();
+ else
+ return (LwpLayoutScale::FIT_IN_FRAME | LwpLayoutScale::MAINTAIN_ASPECT_RATIO);
+}
+
+sal_uInt16 LwpMiddleLayout::GetScaleTile()
+{
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
+ return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::TILED)
+ ? 1 : 0;
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (xBase.is())
+ return dynamic_cast<LwpMiddleLayout&>(*xBase).GetScaleTile();
+ else
+ return 0;
+}
+
+sal_uInt16 LwpMiddleLayout::GetScaleCenter()
+{
+ if (m_bGettingScaleCenter)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingScaleCenter = true;
+
+ sal_uInt16 nRet = 0;
+
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
+ {
+ nRet = (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED)
+ ? 1 : 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (xBase.is())
+ nRet = dynamic_cast<LwpMiddleLayout&>(*xBase).GetScaleCenter();
+ }
+
+ m_bGettingScaleCenter = false;
+ return nRet;
+}
+
+bool LwpMiddleLayout::CanSizeRight()
+{
+ sal_uInt8 RelType = GetRelativeType();
+
+ return !(RelType == LwpLayoutRelativityGuts::LAY_INLINE || RelType == LwpLayoutRelativityGuts::LAY_PARA_RELATIVE
+ || RelType == LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL);
+}
+sal_Int32 LwpMiddleLayout::GetMinimumWidth()
+{
+ if (((m_nAttributes3 & STYLE3_WIDTHVALID) != 0) && GetGeometry())
+ {
+ return GetGeometry()->GetWidth();
+ }
+ else if (m_nOverrideFlag & OVER_SIZE)
+ {
+ return DetermineWidth();
+ }
+ return 0;
+}
+sal_Int32 LwpMiddleLayout::DetermineWidth()
+{
+ if (IsSizeRightToContent())
+ {
+ assert(false);
+ }
+ else if (IsSizeRightToContainer())
+ {
+ assert(false);
+ }
+ else if (LwpLayoutGeometry* pGeo = GetGeometry())
+ {
+ m_nAttributes3 |= STYLE3_WIDTHVALID;
+ return pGeo->GetWidth();
+ }
+ return 0;
+}
+bool LwpMiddleLayout::IsSizeRightToContainer()
+{
+ if (!CanSizeRight())
+ return false;
+
+ if (m_nOverrideFlag & OVER_SIZE)
+ {
+ return (m_nDirection & ((LAY_USEDIRECTION|LAY_AUTOSIZE|LAY_TOCONTAINER)
+ << SHIFT_RIGHT))
+ == ((LAY_USEDIRECTION | LAY_TOCONTAINER | LAY_AUTOSIZE) << SHIFT_RIGHT);
+ }
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (xBase.is())
+ {
+ LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(xBase.get());
+ return pLayout && pLayout->IsSizeRightToContainer();
+ }
+ else
+ return false;
+}
+bool LwpMiddleLayout::IsSizeRightToContent()
+{
+ if (!CanSizeRight())
+ return false;
+
+ if (m_nOverrideFlag & OVER_SIZE)
+ {
+ return (m_nDirection & ((LAY_USEDIRECTION|LAY_AUTOSIZE|LAY_TOCONTAINER)
+ << SHIFT_RIGHT))
+ == ((LAY_USEDIRECTION | LAY_AUTOSIZE) << SHIFT_RIGHT);
+ }
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (xBase.is())
+ {
+ LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(xBase.get());
+ return pLayout && pLayout->IsSizeRightToContent();
+ }
+ else
+ return false;
+}
+
+/**
+* @descr: Get layout height
+*
+*/
+double LwpMiddleLayout::GetHeight()
+{
+ return GetGeometryHeight();
+}
+
+/**
+* @descr: Get layout height
+*
+*/
+double LwpMiddleLayout::GetWidth()
+{
+ return GetGeometryWidth();
+}
+/**
+* @descr: Get layout origin point
+*
+*/
+LwpPoint LwpMiddleLayout::GetOrigin()
+{
+ LwpLayoutGeometry* pGeo = GetGeometry();
+ if(pGeo)
+ {
+ sal_uInt8 nType = GetRelativeType();
+ if(nType == LwpLayoutRelativityGuts::LAY_INLINE
+ || nType == LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE )
+ {
+ return pGeo->GetAbsoluteOrigin();
+ }
+ else
+ return pGeo->GetOrigin();
+
+ }
+
+ return LwpPoint();
+}
+
+/**
+* @descr: Whether the fill is pattern fill or not
+* @return: True if yes, false if not.
+*/
+bool LwpMiddleLayout::IsPatternFill()
+{
+ LwpBackgroundStuff* pBackgroundStuff = GetBackgroundStuff();
+ if (pBackgroundStuff)
+ {
+ return pBackgroundStuff->IsPatternFill();
+ }
+
+ return false;
+}
+
+/**
+* @descr: Get the fill pattern style. Data are saved in a XFBGImage object
+* @return: the fill pattern style.
+*/
+std::unique_ptr<XFBGImage> LwpMiddleLayout::GetFillPattern()
+{
+ LwpBackgroundStuff* pBackgroundStuff = GetBackgroundStuff();
+ if (pBackgroundStuff)
+ {
+ return pBackgroundStuff->GetFillPattern();
+ }
+
+ return std::unique_ptr<XFBGImage>();
+}
+
+/**
+* @descr: Whether the height and width of layout is auto grow
+*
+*/
+bool LwpMiddleLayout::IsAutoGrow()
+{
+ if(m_nOverrideFlag & OVER_SIZE)
+ {
+ return (m_nDirection &
+ ((LAY_AUTOGROW << SHIFT_UP) | (LAY_AUTOGROW << SHIFT_DOWN) |
+ (LAY_AUTOGROW << SHIFT_RIGHT) | (LAY_AUTOGROW << SHIFT_LEFT))) != 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrow();
+ }
+ }
+ return LwpVirtualLayout::IsAutoGrow();
+}
+
+/**
+* @descr: Whether the height of layout is auto grow down
+*
+*/
+bool LwpMiddleLayout::IsAutoGrowDown()
+{
+ if(m_nOverrideFlag & OVER_SIZE)
+ {
+ return (m_nDirection & (LAY_AUTOGROW << SHIFT_DOWN)) != 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetIsAutoGrowDown();
+ }
+ }
+ return LwpVirtualLayout::IsAutoGrowDown();
+}
+
+/**
+* @descr: Whether the height of layout is auto grow up
+*
+*/
+bool LwpMiddleLayout::IsAutoGrowUp()
+{
+ if (m_bGettingAutoGrowUp)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingAutoGrowUp = true;
+
+ bool bRet;
+
+ if (m_nOverrideFlag & OVER_SIZE)
+ {
+ bRet = (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ bRet = pLay->IsAutoGrowUp();
+ else
+ bRet = LwpVirtualLayout::IsAutoGrowUp();
+ }
+
+ m_bGettingAutoGrowUp = false;
+ return bRet;
+}
+
+/**
+* @descr: Whether the height of layout is auto grow down
+*
+*/
+bool LwpMiddleLayout::IsAutoGrowLeft()
+{
+ if(m_nOverrideFlag & OVER_SIZE)
+ {
+ return (m_nDirection & (LAY_AUTOGROW << SHIFT_LEFT)) != 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrowLeft();
+ }
+ }
+ return LwpVirtualLayout::IsAutoGrowLeft();
+}
+
+/**
+* @descr: Whether the height of layout is auto grow down
+*
+*/
+bool LwpMiddleLayout::IsAutoGrowRight()
+{
+ if(m_nOverrideFlag & OVER_SIZE)
+ {
+ return (m_nDirection & (LAY_AUTOGROW << SHIFT_RIGHT)) != 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrowRight();
+ }
+ }
+ return LwpVirtualLayout::IsAutoGrowRight();
+}
+
+/**
+* @descr: Get contents orientation
+*
+*/
+sal_uInt8 LwpMiddleLayout::GetContentOrientation()
+{
+ //content orientation in Graphic objects and OLE objects not supported now
+ if((m_nOverrideFlag & OVER_ROTATION)&& !m_LayGeometry.IsNull())
+ {
+ LwpLayoutGeometry* pLayGeometry = dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj().get());
+ if (pLayGeometry)
+ return pLayGeometry->GetContentOrientation();
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetContentOrientation();
+ }
+ }
+ return LwpVirtualLayout::GetContentOrientation();
+}
+
+/**
+* @descr: Whether it is honoring protection
+*
+*/
+bool LwpMiddleLayout::HonorProtection()
+{
+ if(m_nOverrideFlag & OVER_MISC)
+ {
+ if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
+ return false;
+
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
+ {
+ return xParent->GetHonorProtection();
+ }
+
+ if(m_pFoundry)//is null now
+ {
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ if (pDoc)
+ {
+ return pDoc->GetHonorProtection();
+ }
+ }
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetHonorProtection();
+ }
+ }
+
+ return LwpVirtualLayout::HonorProtection();
+}
+
+/**
+* @descr: Whether it is protected
+*
+*/
+bool LwpMiddleLayout::IsProtected()
+{
+ bool bProtected = false;
+ if(m_nOverrideFlag & OVER_MISC)
+ {
+ bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ bProtected = pLay->GetIsProtected();
+ }
+ else
+ bProtected = LwpVirtualLayout::IsProtected();
+ }
+
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
+ {
+ /* If a parent's protected then none of its children can be accessed. */
+ if (xParent->GetIsProtected())
+ return true;
+
+ if (xParent->GetHonorProtection())
+ return bProtected;
+
+ /* If our parent isn't honoring protection then we aren't protected. */
+ return false;
+
+ }
+ if(m_pFoundry)//is null now
+ {
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ if(pDoc)
+ {
+ if (pDoc->GetHonorProtection())
+ return bProtected;
+
+ /* If the document isn't honoring protection then we aren't protected.*/
+ return false;
+ }
+ }
+
+ return bProtected;
+}
+
+/**
+* @descr: Get watermark layout
+*
+*/
+rtl::Reference<LwpVirtualLayout> LwpMiddleLayout::GetWaterMarkLayout()
+{
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
+ while (xLay.is())
+ {
+ aSeen.insert(xLay.get());
+ if (xLay->IsForWaterMark())
+ {
+ return xLay;
+ }
+ rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+ if (aSeen.find(xNext.get()) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ xLay = xNext;
+ }
+ return rtl::Reference<LwpVirtualLayout>();
+}
+
+/**
+* @descr: Create and return xfbgimage object for watermark
+*
+*/
+std::unique_ptr<XFBGImage> LwpMiddleLayout::GetXFBGImage()
+{
+ std::unique_ptr<XFBGImage> xXFBGImage;
+
+ rtl::Reference<LwpVirtualLayout> xWaterMarkLayout(GetWaterMarkLayout());
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xWaterMarkLayout.get());
+ if(pLay)
+ {
+ //test BGImage
+ LwpGraphicObject* pGrfObj = dynamic_cast<LwpGraphicObject*>(pLay->GetContent().obj().get());
+ if(pGrfObj)
+ {
+ xXFBGImage.reset(new XFBGImage);
+ if(pGrfObj->IsLinked())
+ {
+ //set file link
+ OUString linkedfilepath = pGrfObj->GetLinkedFilePath();
+ OUString fileURL = LwpTools::convertToFileUrl(OUStringToOString(linkedfilepath, osl_getThreadTextEncoding()));
+ xXFBGImage->SetFileLink(fileURL);
+ }
+ else
+ {
+ std::vector<sal_uInt8> aGrafData = pGrfObj->GetRawGrafData();
+ xXFBGImage->SetImageData(aGrafData.data(), aGrafData.size());
+ }
+
+ //automatic, top left
+ xXFBGImage->SetPosition(enumXFAlignStart,enumXFAlignTop);
+ if(pLay->GetScaleCenter())
+ {
+ //center
+ xXFBGImage->SetPosition();
+ }
+ else if(pLay->GetScaleTile())
+ {
+ //tile
+ xXFBGImage->SetRepeate();
+ }
+ //fit type, area type
+ if((pLay->GetScaleMode()& LwpLayoutScale::FIT_IN_FRAME)!=0)
+ {
+ if((pLay->GetScaleMode()& LwpLayoutScale::MAINTAIN_ASPECT_RATIO)==0)
+ {
+ xXFBGImage->SetStretch();
+ }
+ }
+ }
+ }
+ return xXFBGImage;
+}
+
+/**
+* @descr: Whether the page uses the printer setting
+*
+*/
+bool LwpMiddleLayout::GetUsePrinterSettings()
+{
+ if (m_bGettingUsePrinterSettings)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingUsePrinterSettings = true;
+
+ bool bRet = false;
+
+ if(m_nOverrideFlag & OVER_SIZE)
+ {
+ bRet = (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ bRet = pLay->GetUsePrinterSettings();
+ }
+ }
+
+ m_bGettingUsePrinterSettings = false;
+ return bRet;
+}
+
+//Check whether there are contents in the layout
+bool LwpMiddleLayout::HasContent()
+{
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ return content.is();
+}
+
+LwpLayout::LwpLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpMiddleLayout(objHdr, pStrm)
+ , m_bGettingShadow(false)
+ , m_bGettingNumCols(false)
+{
+}
+
+LwpLayout::~LwpLayout()
+{
+}
+
+void LwpLayout::Read()
+{
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+
+ LwpMiddleLayout::Read();
+ if (LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ // read PreRevBLayout...
+ }
+ else
+ {
+ sal_uInt16 nSimple = pStrm->QuickReaduInt16();
+
+ if (!nSimple)
+ {
+ m_aUseWhen.Read(pStrm);
+
+ sal_uInt8 nFlag = pStrm->QuickReaduInt8();
+ if (nFlag)
+ m_Position.ReadIndexed(pStrm);
+ }
+
+ m_LayColumns.ReadIndexed(pStrm);
+ m_LayGutterStuff.ReadIndexed(pStrm);
+ m_LayJoinStuff.ReadIndexed(pStrm);
+ m_LayShadow.ReadIndexed(pStrm);
+
+ if (pStrm->CheckExtra())
+ {
+ m_LayExtJoinStuff.ReadIndexed(pStrm);
+ pStrm->SkipExtra();
+ }
+ }
+}
+
+/**
+* @descr: Get columns number
+*
+*/
+sal_uInt16 LwpLayout::GetNumCols()
+{
+ if (m_bGettingNumCols)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingNumCols = true;
+
+ sal_uInt16 nRet = 0;
+ LwpLayoutColumns* pLayColumns = (m_nOverrideFlag & OVER_COLUMNS) ? dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get()) : nullptr;
+ if (pLayColumns)
+ {
+ nRet = pLayColumns->GetNumCols();
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
+ nRet = pStyle ? pStyle->GetNumCols() : LwpVirtualLayout::GetNumCols();
+ }
+ m_bGettingNumCols = false;
+ return nRet;
+}
+
+
+/**
+* @descr: Get gap between columns
+* @param: the order of column
+*/
+double LwpLayout::GetColGap(sal_uInt16 nIndex)
+{
+ if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO))
+ {
+ LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get());
+ if(pLayColumns)
+ {
+ return pLayColumns->GetColGap(nIndex);
+ }
+ }
+
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
+ if (pStyle)
+ {
+ return pStyle->GetColGap(nIndex);
+ }
+
+ return LwpVirtualLayout::GetColGap(nIndex);
+}
+
+/**
+* @descr: Create and return XFColumns object
+*
+*/
+XFColumns* LwpLayout::GetXFColumns()
+{
+ //if there is only one column, do not need insert columns
+ sal_uInt16 nCols = GetNumCols();
+ if(nCols==1)
+ {
+ return nullptr;
+ }
+
+ std::unique_ptr<XFColumns> xColumns(new XFColumns);
+ //set XFColumnSep
+ std::unique_ptr<XFColumnSep> xColumnSep(GetColumnSep());
+ if (xColumnSep)
+ {
+ xColumns->SetSeparator(*xColumnSep);
+ }
+
+ //set column count and column gap
+ xColumns->SetCount(nCols);
+ double fGap = GetColGap(0);
+ xColumns->SetGap(fGap);
+
+ //set xfcolumn
+ for(sal_uInt16 nIndex = 0; nIndex<nCols; nIndex++)
+ {
+ XFColumn aColumn;
+ sal_Int32 nWidth = 8305/nCols; //relative width
+ aColumn.SetRelWidth(nWidth);
+
+ //the left and right margins is 0;
+ double nGap = GetColGap(nIndex)/2;
+ aColumn.SetMargins(nGap,nGap);
+ if(nIndex==0)
+ {
+ aColumn.SetMargins(0,nGap);
+ }
+ if(nIndex==(nCols-1))
+ {
+ aColumn.SetMargins(nGap,0);
+ }
+ xColumns->AddColumn(aColumn);
+ }
+
+ return xColumns.release();
+}
+
+/**
+* @descr: Create and return XFColumnSep object
+*
+*/
+XFColumnSep* LwpLayout::GetColumnSep()
+{
+
+ //Get LwpLayoutGutters
+ LwpLayoutGutters* pLayoutGutters = dynamic_cast<LwpLayoutGutters*>(m_LayGutterStuff.obj().get());
+ if(!pLayoutGutters)
+ {
+ return nullptr;
+ }
+
+ LwpBorderStuff& rBorderStuff = pLayoutGutters->GetBorderStuff();
+
+ LwpBorderStuff::BorderType eType = LwpBorderStuff::LEFT;
+ LwpColor aColor = rBorderStuff.GetSideColor(eType);
+ double fWidth = rBorderStuff.GetSideWidth(eType);
+ //sal_uInt16 nType = rBorderStuff->GetSideType(eType);
+
+ XFColumnSep* pColumnSep = new XFColumnSep();
+ XFColor aXFColor(aColor.To24Color());
+ pColumnSep->SetColor(aXFColor);
+ pColumnSep->SetWidth(fWidth);
+ pColumnSep->SetRelHeight(100);
+ pColumnSep->SetVerticalAlign(enumXFAlignTop);
+
+ return pColumnSep;
+}
+
+/**
+* @descr: Get use when type
+*
+*/
+LwpLayout::UseWhenType LwpLayout::GetUseWhenType()
+{
+ UseWhenType eType = StartWithinPage;
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(pUseWhen)
+ {
+ if(pUseWhen->IsStartOnThisHF())
+ {
+ eType = StartWithinColume;
+ }
+ else if(pUseWhen->IsStartOnThisPage())
+ {
+ eType = StartWithinPage;
+ }
+ else if(pUseWhen->IsStartOnNextPage())
+ {
+ eType = StartOnNextPage;
+ }
+ else if(pUseWhen->IsStartOnNextOddPage())
+ {
+ eType = StartOnOddPage;
+ }
+ else if(pUseWhen->IsStartOnNextEvenPage())
+ {
+ eType = StartOnEvenPage;
+ }
+
+ }
+ else
+ {
+ eType = StartOnNextPage;
+ }
+ return eType;
+}
+
+/**
+* @descr: Get use page
+*
+*/
+sal_uInt16 LwpLayout::GetUsePage()
+{
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(pUseWhen)
+ return pUseWhen->GetUsePage();
+ else
+ return 0;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->GetUsePage();
+ }
+ }
+ return 0;
+}
+
+/**
+* @descr: Get usewhen pointer
+*
+*/
+LwpUseWhen* LwpLayout::VirtualGetUseWhen()
+{
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ return &m_aUseWhen;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->VirtualGetUseWhen();
+ }
+ }
+ return LwpVirtualLayout::VirtualGetUseWhen();
+}
+
+/**
+* @descr: Whether it is use on all pages
+*
+*/
+bool LwpLayout::IsUseOnAllPages()
+{
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(pUseWhen)
+ return pUseWhen->IsUseOnAllPages();
+ else
+ return false;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnAllPages();
+ }
+ }
+ return LwpVirtualLayout::IsUseOnAllPages();
+}
+
+/**
+* @descr: Whether it is use on all even pages
+*
+*/
+bool LwpLayout::IsUseOnAllEvenPages()
+{
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(pUseWhen)
+ return pUseWhen->IsUseOnAllEvenPages();
+ else
+ return false;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnAllEvenPages();
+ }
+ }
+ return LwpVirtualLayout::IsUseOnAllEvenPages();
+}
+
+/**
+* @descr: Whether it is use on all odd pages
+*
+*/
+bool LwpLayout::IsUseOnAllOddPages()
+{
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(pUseWhen)
+ return pUseWhen->IsUseOnAllOddPages();
+ else
+ return false;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnAllOddPages();
+ }
+ }
+ return LwpVirtualLayout::IsUseOnAllOddPages();
+}
+
+/**
+* @descr: Whether it is use on current page
+*
+*/
+bool LwpLayout::IsUseOnPage()
+{
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(pUseWhen)
+ return pUseWhen->IsUseOnPage();
+ else
+ return false;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnPage();
+ }
+ }
+ return LwpVirtualLayout::IsUseOnPage();
+}
+
+/**
+ * @descr: Get the LwpShadow object according to m_LayShadow id.
+*/
+LwpShadow* LwpLayout::GetShadow()
+{
+ if (m_bGettingShadow)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingShadow = true;
+ LwpShadow* pRet = nullptr;
+ if(m_nOverrideFlag & OVER_SHADOW)
+ {
+ LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj().get());
+ pRet = pLayoutShadow ? &pLayoutShadow->GetShadow() : nullptr;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ pRet = pLay->GetShadow();
+ }
+ }
+ m_bGettingShadow = false;
+ return pRet;
+}
+
+/**
+ * @descr: create xfshadow
+*/
+XFShadow* LwpLayout::GetXFShadow()
+{
+ LwpShadow* pShadow = GetShadow();
+ if( pShadow )
+ {
+ LwpColor color = pShadow->GetColor();
+ double offsetX = pShadow->GetOffsetX();
+ double offsetY = pShadow->GetOffsetY();
+
+ if( offsetX && offsetY && color.IsValidColor() )
+ {
+ XFShadow* pXFShadow = new XFShadow();
+ enumXFShadowPos eXFShadowPos = enumXFShadowLeftTop;
+ double fOffset = 0;
+
+ bool left = false;
+ bool top = false;
+ if( offsetX < 0 )
+ left = true;
+ if( offsetY < 0 )
+ top = true;
+ if( left )
+ {
+ fOffset = -offsetX;
+ if( top )
+ eXFShadowPos = enumXFShadowLeftTop;
+ else
+ eXFShadowPos = enumXFShadowLeftBottom;
+ }
+ else
+ {
+ fOffset = offsetX;
+ if( top )
+ eXFShadowPos = enumXFShadowRightTop;
+ else
+ eXFShadowPos = enumXFShadowRightBottom;
+ }
+
+ pXFShadow->SetPosition(eXFShadowPos);
+ pXFShadow->SetOffset(fOffset);
+ pXFShadow->SetColor(XFColor(color.To24Color()));
+
+ return pXFShadow;
+ }
+ }
+ return nullptr;
+}
+
+/**
+ * @descr get the layout that containers the current frame layout
+ *
+ */
+rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
+{
+ if(IsRelativeAnchored())
+ {
+ //get position
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition().obj().get());
+ if(pPara)
+ {
+ LwpStory* pStory = pPara->GetStory();
+ return pStory ? pStory->GetTabLayout() : nullptr;
+ }
+ }
+ return GetParentLayout();
+}
+
+LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm )
+ : LwpLayout(objHdr, pStrm)
+ , m_bGettingWrapType(false)
+ , m_bGettingLayoutRelativity(false)
+ , m_nWrapType(0)
+ , m_nBuoyancy(0)
+ , m_nBaseLineOffset(0)
+{}
+
+LwpPlacableLayout::~LwpPlacableLayout()
+{}
+
+void LwpPlacableLayout::Read()
+{
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+ LwpLayout::Read();
+ if(LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ assert(false);
+ }
+ else
+ {
+ sal_uInt16 simple = pStrm->QuickReaduInt16();
+ if(!simple)
+ {
+ m_nWrapType = pStrm->QuickReaduInt8();
+ m_nBuoyancy = pStrm->QuickReaduInt8();
+ m_nBaseLineOffset = pStrm->QuickReadInt32();
+ m_Script.Read( pStrm);
+ }
+ else
+ {
+ m_nWrapType = LAY_WRAP_AROUND;
+ m_nBuoyancy = LAY_BUOYNEUTRAL;
+ m_nBaseLineOffset = 0;
+ }
+ m_LayRelativity.ReadIndexed( pStrm);
+ if(pStrm->CheckExtra())
+ {
+ sal_uInt16 count = pStrm->QuickReaduInt16();
+ if(count)
+ {
+ // temporarily added by to avoid assertion
+ while (count)
+ {
+ LwpPoint aPoint;
+ aPoint.Read(pStrm);
+ count--;
+ }
+ }
+ pStrm->SkipExtra();
+ }
+ }
+}
+/**
+ * @descr: get wrap type
+*/
+sal_uInt8 LwpPlacableLayout::GetWrapType()
+{
+ if (m_bGettingWrapType)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingWrapType = true;
+ sal_uInt8 nWrapType = LAY_WRAP_AROUND;
+ if (m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ nWrapType = m_nWrapType;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
+ {
+ nWrapType = pLay->GetWrapType();
+ }
+ }
+ m_bGettingWrapType = false;
+ return nWrapType;
+}
+/**
+ * @descr: get LayoutRelativity
+*/
+LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
+{
+ if (m_bGettingLayoutRelativity)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingLayoutRelativity = true;
+ LwpLayoutRelativity* pRet = nullptr;
+ if (!m_LayRelativity.IsNull())
+ {
+ if (m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ pRet = dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
+ }
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
+ {
+ pRet = pLay->GetRelativityPiece();
+ }
+ }
+ m_bGettingLayoutRelativity = false;
+ return pRet;
+}
+/**
+* @descr: Get relative type
+*
+*/
+sal_uInt8 LwpPlacableLayout::GetRelativeType()
+{
+ LwpLayoutRelativity* pLayRel = GetRelativityPiece();
+ if(pLayRel)
+ {
+ return pLayRel->GetRelGuts().GetRelativeType();
+ }
+ return LwpVirtualLayout::GetRelativeType();
+}
+/**
+* @descr: Get offset from the baseline
+*
+*/
+sal_Int32 LwpPlacableLayout::GetBaseLineOffset()
+{
+ /* The baseline is only valid if this is flow-with-text */
+ if(GetRelativeType()!=LwpLayoutRelativityGuts::LAY_INLINE)
+ {
+ return 0;
+ }
+
+ // First, ask our content if it has a baseline, ignore now
+ /*
+ if (Content && Content->GetBaseLineOffset(&Baseline))
+ return Baseline;
+ */
+
+ if(m_nOverrideFlag & OVER_PLACEMENT)
+ {
+ return m_nBaseLineOffset;
+ }
+ else
+ {
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
+ {
+ return pLay->GetBaseLineOffset();
+ }
+ }
+ return 0;
+
+}
+/**
+* @descr: whether the parent layout is page layout
+*
+*/
+bool LwpPlacableLayout::IsAnchorPage()
+{
+ if(IsRelativeAnchored())
+ return false;
+
+ rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+ return xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter());
+}
+/**
+* @descr: whether the parent layout is frame layout
+*
+*/
+bool LwpPlacableLayout::IsAnchorFrame()
+{
+ if(IsRelativeAnchored())
+ return false;
+
+ rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+ return xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead());
+}
+/**
+* @descr: whether the parent layout is cell layout
+*
+*/
+bool LwpPlacableLayout::IsAnchorCell()
+{
+ if(IsRelativeAnchored())
+ return false;
+
+ rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+ return xLayout.is() && xLayout->IsCell();
+}
+
+/**
+* @descr: Set font style for setting position of frame
+*
+*/
+void LwpPlacableLayout::SetFont(rtl::Reference<XFFont> const & pFont)
+{
+ m_pFont = pFont;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
new file mode 100644
index 000000000..9ac89fddc
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -0,0 +1,512 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUT_HXX
+
+#include <memory>
+#include <sal/config.h>
+#include <config_lgpl.h>
+
+#include <rtl/ref.hxx>
+
+#include <lwpobj.hxx>
+#include <lwpobjhdr.hxx>
+#include <lwpobjstrm.hxx>
+#include <lwpobjid.hxx>
+#include "lwpdlvlist.hxx"
+
+#include "lwplayoutdef.hxx"
+#include <xfilter/xfdefs.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xfpagemaster.hxx>
+#include <xfilter/xfcolumns.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfbgimage.hxx>
+#include "lwpusewhen.hxx"
+#include "lwplaypiece.hxx"
+
+
+#define FIRST_LAYOUTPAGENO 0x0001
+#define LAST_LAYOUTPAGENO 0xffff
+
+#define LAY_BUOYNEUTRAL 0x02
+#define LAY_BUOYLAYER 0x80
+
+class LwpPara;
+class LwpVirtualLayout : public LwpDLNFPVList
+{
+public:
+ LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual sal_uInt16 GetNumCols(){return 1;}
+ virtual double GetColGap(sal_uInt16 nIndex);
+ virtual bool IsAutoGrow(){ return false;}
+ virtual bool IsAutoGrowUp(){ return false;}
+ virtual bool IsAutoGrowLeft(){ return false;}
+ virtual bool IsAutoGrowRight(){ return false;}
+ bool IsFitGraphic();
+ bool IsAutoGrowWidth();
+ bool IsInlineToMargin() const;
+ virtual sal_uInt8 GetContentOrientation(){ return TEXT_ORIENT_LRTB;}
+ bool GetHonorProtection()
+ {
+ if (m_bGettingHonorProtection)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingHonorProtection = true;
+ bool bRet = HonorProtection();
+ m_bGettingHonorProtection = false;
+ return bRet;
+ }
+ bool GetMarginsSameAsParent()
+ {
+ if (m_bGettingMarginsSameAsParent)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingMarginsSameAsParent = true;
+ bool bRet = MarginsSameAsParent();
+ m_bGettingMarginsSameAsParent = false;
+ return bRet;
+ }
+ bool GetIsProtected()
+ {
+ if (m_bGettingIsProtected)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingIsProtected = true;
+ bool bRet = IsProtected();
+ m_bGettingIsProtected = false;
+ return bRet;
+ }
+ bool GetIsAutoGrowDown()
+ {
+ if (m_bGettingIsAutoGrowDown)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingIsAutoGrowDown = true;
+ bool bRet = IsAutoGrowDown();
+ m_bGettingIsAutoGrowDown = false;
+ return bRet;
+ }
+ bool GetHasProtection()
+ {
+ if (m_bGettingHasProtection)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingHasProtection = true;
+ bool bRet = HasProtection();
+ m_bGettingHasProtection = false;
+ return bRet;
+ }
+ double GetMarginsValue(sal_uInt8 nWhichSide)
+ {
+ if (m_bGettingMarginsValue)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingMarginsValue = true;
+ auto fRet = MarginsValue(nWhichSide);
+ m_bGettingMarginsValue = false;
+ return fRet;
+ }
+ double GetExtMarginsValue(sal_uInt8 nWhichSide)
+ {
+ if (m_bGettingExtMarginsValue)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingExtMarginsValue = true;
+ auto fRet = ExtMarginsValue(nWhichSide);
+ m_bGettingExtMarginsValue = false;
+ return fRet;
+ }
+ const OUString& GetStyleName() const { return m_StyleName;}
+ bool IsComplex() const;
+ virtual bool IsAnchorPage(){ return false;}
+ virtual bool IsAnchorFrame(){ return false;}
+ virtual bool IsAnchorCell(){ return false;}
+ bool IsPage();
+ bool IsHeader();
+ bool IsFooter();
+ bool IsFrame();
+ bool IsCell();
+ bool IsSuperTable();
+ bool IsGroupHead();
+ virtual sal_uInt8 GetRelativeType();
+ bool IsRelativeAnchored();
+ LwpUseWhen* GetUseWhen();
+ virtual LwpUseWhen* VirtualGetUseWhen(){ return nullptr;}
+ virtual bool IsUseOnAllPages(){ return false;}
+ virtual bool IsUseOnAllEvenPages(){ return false;}
+ virtual bool IsUseOnAllOddPages(){ return false;}
+ virtual bool IsUseOnPage(){ return false;}
+ virtual sal_Int32 GetPageNumber(sal_uInt16 /*nLayoutNumber*/) { return -1;}
+ bool IsMinimumHeight() const;
+ virtual bool IsForWaterMark(){ return false;}
+ virtual LwpPara* GetLastParaOfPreviousStory() { return nullptr; }
+ rtl::Reference<LwpVirtualLayout> GetParentLayout();
+ virtual rtl::Reference<LwpVirtualLayout> GetContainerLayout() { return rtl::Reference<LwpVirtualLayout>(); }
+ void RegisterChildStyle();
+ bool NoContentReference();
+ bool IsStyleLayout();
+ enumXFAlignType GetVerticalAlignmentType() const
+ {
+ if (m_nAttributes & STYLE_CENTEREDVERTICALLY)
+ {
+ return enumXFAlignMiddle;
+ }
+ else if (m_nAttributes & STYLE_BOTTOMALIGNED)
+ {
+ return enumXFAlignBottom;
+ }
+ return enumXFAlignTop;
+ };
+ void SetStyleName(const OUString & str){ m_StyleName = str;}
+ virtual double GetWidth(){return -1;}
+
+ //Check whether there are contents in the layout
+ virtual bool HasContent(){return false;}
+ //End by
+protected:
+ void Read() override;
+ bool HasProtection();
+ virtual bool HonorProtection();
+ virtual bool IsProtected();
+ virtual bool IsAutoGrowDown(){ return false;}
+ virtual double MarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
+ virtual double ExtMarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
+ virtual bool MarginsSameAsParent();
+protected:
+ bool m_bGettingHonorProtection;
+ bool m_bGettingMarginsSameAsParent;
+ bool m_bGettingHasProtection;
+ bool m_bGettingIsProtected;
+ bool m_bGettingIsAutoGrowDown;
+ bool m_bGettingMarginsValue;
+ bool m_bGettingExtMarginsValue;
+ bool m_bGettingUsePrinterSettings;
+ bool m_bGettingScaleCenter;
+ bool m_bGettingBorderStuff;
+ bool m_bGettingUseWhen;
+ bool m_bGettingStyleLayout;
+ bool m_bGettingAutoGrowUp;
+ sal_uInt32 m_nAttributes;
+ sal_uInt32 m_nAttributes2;
+ sal_uInt32 m_nAttributes3;
+ sal_uInt32 m_nOverrideFlag;
+ sal_uInt16 m_nDirection;
+ sal_uInt16 m_nEditorID;
+ LwpObjectID m_NextEnumerated;
+ LwpObjectID m_PreviousEnumerated;
+ OUString m_StyleName;
+ enum LWP_LAYOUT_TYPE
+ {
+ LWP_VIRTUAL_LAYOUT,
+ LWP_HEAD_LAYOUT,
+ LWP_PAGE_LAYOUT,
+ LWP_HEADER_LAYOUT,
+ LWP_FOOTER_LAYOUT,
+ LWP_FRAME_LAYOUT,
+ LWP_SUPERTABLE_LAYOUT,
+ LWP_TABLE_LAYOUT,
+ LWP_ROW_LAYOUT,
+ LWP_COLUMN_LAYOUT,
+ LWP_CELL_LAYOUT,
+ LWP_CONNECTED_CELL_LAYOUT,
+ LWP_HIDDEN_CELL_LAYOUT,
+ LWP_TABLE_HEADING_LAYOUT,
+ LWP_ROW_HEADING_LAYOUT,
+ LWP_DROPCAP_LAYOUT,
+ LWP_GROUP_LAYOUT,
+ LWP_TOC_SUPERTABLE_LAYOUT,
+ LWP_FOOTNOTE_LAYOUT,
+ LWP_FOOTNOTE_ROW_LAYOUT,
+ LWP_FOOTNOTE_CELL_LAYOUT,
+ LWP_ENDNOTE_LAYOUT,
+ LWP_ENDNOTE_SUPERTABLE_LAYOUT,
+ LWP_FOOTNOTE_SUPERTABLE_LAYOUT,
+ LWP_NOTE_LAYOUT,
+ LWP_NOTEHEADER_LAYOUT,
+ LWP_NOTETEXT_LAYOUT,
+ LWP_VIEWPORT_LAYOUT
+ };
+ enum LayoutDirection
+ {
+ LAY_USEDIRECTION = 0x01,
+ LAY_AUTOGROW = 0x02,
+ LAY_AUTOSIZE = 0x04,
+ LAY_TOCONTAINER = 0x08,
+ LAY_DIRALLBITS = 0x0f
+ };
+ enum {SHIFT_UP = 0, SHIFT_DOWN = 4, SHIFT_LEFT = 8, SHIFT_RIGHT =12};
+public:
+ virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_VIRTUAL_LAYOUT;}
+ LwpVirtualLayout* FindChildByType(LWP_LAYOUT_TYPE eType);
+};
+
+class LwpAssociatedLayouts final
+{
+public:
+ LwpAssociatedLayouts(){}
+ void Read(LwpObjectStream* pStrm);
+ LwpObjectID& GetOnlyLayout() { return m_OnlyLayout;}
+ rtl::Reference<LwpVirtualLayout> GetLayout(LwpVirtualLayout const * pStartLayout);
+private:
+ LwpObjectID m_OnlyLayout; //LwpVirtualLayout
+ LwpDLVListHeadTail m_Layouts;
+};
+
+class LwpHeadLayout : public LwpVirtualLayout
+{
+public:
+ LwpHeadLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ void RegisterStyle() override;
+ rtl::Reference<LwpVirtualLayout> FindEnSuperTableLayout();
+protected:
+ void Read() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HEAD_LAYOUT;}
+};
+
+class LwpLayoutStyle final
+{
+public:
+ LwpLayoutStyle();
+ ~LwpLayoutStyle();
+ void Read(LwpObjectStream* pStrm);
+private:
+ sal_uInt32 m_nStyleDefinition;
+ std::unique_ptr<LwpAtomHolder> m_pDescription;
+ sal_uInt16 m_nKey;
+};
+
+class LwpLayoutMisc final
+{
+public:
+ LwpLayoutMisc();
+ ~LwpLayoutMisc();
+ void Read(LwpObjectStream* pStrm);
+private:
+ sal_Int32 m_nGridDistance;
+ sal_uInt16 m_nGridType;
+ LwpAtomHolder m_aContentStyle;
+};
+
+class LwpMiddleLayout : public LwpVirtualLayout
+{
+public:
+ LwpMiddleLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm );
+ virtual ~LwpMiddleLayout() override;
+ double GetGeometryHeight();
+ double GetGeometryWidth();
+ LwpBorderStuff* GetBorderStuff();
+ LwpBackgroundStuff* GetBackgroundStuff();
+ LwpLayoutGeometry* GetGeometry();
+ enumXFTextDir GetTextDirection();
+ std::unique_ptr<XFBorders> GetXFBorders();
+ LwpColor* GetBackColor();
+ virtual bool IsAutoGrow() override;
+ virtual bool IsAutoGrowUp() override;
+ virtual bool IsAutoGrowLeft() override;
+ virtual bool IsAutoGrowRight() override;
+ virtual sal_uInt8 GetContentOrientation() override;
+ virtual bool HonorProtection() override;
+ virtual bool IsProtected() override;
+ rtl::Reference<LwpVirtualLayout> GetWaterMarkLayout();
+ std::unique_ptr<XFBGImage> GetXFBGImage();
+ bool GetUsePrinterSettings();
+
+ LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj().get());}
+ sal_uInt16 GetScaleMode();
+ sal_uInt16 GetScaleTile();
+ sal_uInt16 GetScaleCenter();
+
+ bool CanSizeRight();
+ virtual double GetWidth() override;
+ sal_Int32 GetMinimumWidth();
+ bool IsSizeRightToContent();
+ bool IsSizeRightToContainer();
+ sal_Int32 DetermineWidth();
+ virtual double GetHeight();
+ LwpPoint GetOrigin();
+
+ bool IsPatternFill();
+ std::unique_ptr<XFBGImage> GetFillPattern();
+
+ //Check whether there are contents in the layout
+ virtual bool HasContent() override;
+
+protected:
+ void Read() override;
+ virtual bool MarginsSameAsParent() override;
+ virtual double MarginsValue(sal_uInt8 nWhichSide) override;
+ virtual double ExtMarginsValue(sal_uInt8 nWhichSide) override;
+ virtual bool IsAutoGrowDown() override;
+private:
+ LwpObjectID m_BasedOnStyle;
+protected:
+ enum
+ {
+ DISK_GOT_STYLE_STUFF = 0x01,
+ DISK_GOT_MISC_STUFF = 0x02
+ };
+
+ LwpObjectID m_Content;
+ rtl::Reference<LwpObject> GetBasedOnStyle() const;
+ LwpObjectID m_TabPiece;
+ LwpLayoutStyle m_aStyleStuff;
+ LwpLayoutMisc m_aMiscStuff;
+ LwpObjectID m_LayGeometry;
+ LwpObjectID m_LayScale;
+ LwpObjectID m_LayMargins;
+ LwpObjectID m_LayBorderStuff;
+ LwpObjectID m_LayBackgroundStuff;
+ LwpObjectID m_LayExtBorderStuff;
+ bool m_bGettingGeometry;
+ bool m_bGettingBackgroundStuff;
+public:
+ LwpObjectID& GetContent() { return m_Content; }
+ LwpTabOverride* GetTabOverride();
+};
+
+class LwpLayout : public LwpMiddleLayout
+{
+private:
+ bool m_bGettingShadow;
+ bool m_bGettingNumCols;
+public:
+ LwpLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm );
+ virtual ~LwpLayout() override;
+ XFColumns* GetXFColumns();
+ XFColumnSep* GetColumnSep();
+ LwpShadow* GetShadow();
+ XFShadow* GetXFShadow();
+protected:
+ void Read() override;
+protected:
+ LwpUseWhen m_aUseWhen;
+ LwpObjectID m_Position;
+ LwpObjectID m_LayColumns;
+ LwpObjectID m_LayGutterStuff;
+ LwpObjectID m_LayJoinStuff;
+ LwpObjectID m_LayShadow;
+ LwpObjectID m_LayExtJoinStuff;
+
+public:
+ LwpUseWhen* VirtualGetUseWhen() override;
+ virtual sal_uInt16 GetNumCols() override;
+ virtual double GetColGap(sal_uInt16 nIndex) override;
+ sal_uInt16 GetUsePage();
+public:
+ enum UseWhenType
+ {
+ StartWithinColume,
+ StartWithinPage,
+ StartOnNextPage,
+ StartOnOddPage,
+ StartOnEvenPage
+ };
+public:
+ UseWhenType GetUseWhenType();
+ virtual bool IsUseOnAllPages() override;
+ virtual bool IsUseOnAllEvenPages() override;
+ virtual bool IsUseOnAllOddPages() override;
+ virtual bool IsUseOnPage() override;
+ LwpObjectID& GetPosition(){ return m_Position;}
+ virtual rtl::Reference<LwpVirtualLayout> GetContainerLayout() override;
+};
+
+class LwpPlacableLayout : public LwpLayout
+{
+public:
+ LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm );
+ virtual ~LwpPlacableLayout() override;
+ sal_uInt8 GetWrapType();
+ LwpLayoutRelativity* GetRelativityPiece();
+ virtual sal_uInt8 GetRelativeType() override;
+ sal_Int32 GetBaseLineOffset();
+ virtual bool IsAnchorPage() override;
+ virtual bool IsAnchorFrame() override;
+ virtual bool IsAnchorCell() override;
+ virtual void XFConvertFrame(XFContentContainer* /*pCont*/, sal_Int32 /*nStart*/ = 0, sal_Int32 /*nEnd*/ = 0, bool /*bAll*/ = false) {}
+ /**
+ * @descr: Get font style for setting position of frame
+ *
+ */
+ const rtl::Reference<XFFont>& GetFont() const { return m_pFont; }
+ void SetFont(rtl::Reference<XFFont> const & pFont);
+ enum WrapType
+ {
+ LAY_WRAP_AROUND = 1,
+ LAY_NO_WRAP_BESIDE,
+ LAY_NO_WRAP_AROUND,
+ LAY_WRAP_LEFT,
+ LAY_WRAP_RIGHT,
+ LAY_WRAP_BOTH,
+ LAY_WRAP_IRREG_BOTH,
+ LAY_WRAP_IRREG_LEFT,
+ LAY_WRAP_IRREG_RIGHT,
+ LAY_WRAP_IRREG_BIGGEST
+ };
+protected:
+ void Read() override;
+protected:
+ bool m_bGettingWrapType;
+ bool m_bGettingLayoutRelativity;
+ sal_uInt8 m_nWrapType;
+ sal_uInt8 m_nBuoyancy;
+ sal_Int32 m_nBaseLineOffset;
+ LwpAtomHolder m_Script;
+ LwpObjectID m_LayRelativity;
+ rtl::Reference<XFFont> m_pFont;//for frame position
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplayoutdef.hxx b/lotuswordpro/source/filter/lwplayoutdef.hxx
new file mode 100644
index 000000000..2dcd569d3
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplayoutdef.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUTDEF_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUTDEF_HXX
+
+#define STYLE_AUTOLINK 0x01UL /* content span's to next container */
+#define STYLE_SELECTABLE 0x02UL /* selectable container */
+#define STYLE_SHARED 0x04UL /* is this a global layout style */
+#define STYLE_PAINTMARGINSINCOLOR 0x8UL /* does this layout paint margins */
+#define STYLE_PROTECTED 0x10UL /* is this layout protected */
+#define STYLE_LOCAL 0x20UL /* is local layout */
+#define STYLE_NOERRORCHECK 0x40UL /* is error checking enabled */
+#define STYLE_HEADING 0x80UL /* heading */
+#define STYLE_MUTE 0x100UL /* gray modify menu */
+#define STYLE_SCRIPTING 0x200UL /* scripting enabled */
+#define STYLE_CONTENTREPLACEABLE 0x400UL /* contents can be replaced */
+#define STYLE_PRINTABLE 0x800UL /* contents can be printed */
+#define STYLE_COLUMNBALANCE 0x1000UL
+#define STYLE_LANDSCAPE 0x2000UL
+#define STYLE_COLLAPSIBLE 0x4000UL
+#define STYLE_COLLAPSED 0x8000UL
+#define STYLE_NOTCOPYABLE 0x10000UL
+#define STYLE_PARENTSELECTABLE 0x20000UL
+#define STYLE_CONNECTED 0x40000UL
+#define STYLE_OVERRIDE 0x80000UL /* is layout an override */
+#define STYLE_SELECTED 0x100000UL
+#define STYLE_CENTEREDHORIZONTALLY 0x200000UL
+#define STYLE_CREATIONREVISION 0x400000UL
+#define STYLE_DELETIONREVISION 0x800000UL
+#define STYLE_PAGEBREAK 0x1000000UL
+#define STYLE_MODIFIED 0x2000000UL
+#define STYLE_INDIRECT 0x4000000UL /* double click required */
+#define STYLE_COMPLEX 0x8000000UL
+#define STYLE_CENTEREDVERTICALLY 0x10000000UL
+#define STYLE_BOTTOMALIGNED 0x20000000UL
+#define STYLE_NOTGROUPABLE 0x40000000UL
+#define STYLE_ABSOLUTE 0x80000000UL
+// Don't assign these flags from one layout to another
+#define STYLE_DONTASSIGN (STYLE_SHARED)
+
+#define STYLE2_VSCROLLABLE 0x1UL
+#define STYLE2_HSCROLLABLE 0x2UL
+#define STYLE2_SCROLLABLE 0x3UL
+#define STYLE2_MIRROR 0x4UL
+#define STYLE2_PRIVATE 0x8UL
+#define STYLE2_PUBLIC 0x00UL
+#define STYLE2_PRIVATE2 0x10UL
+#define STYLE2_PROTECTED 0x20UL
+#define STYLE2_ACCESSRIGHTS 0x30UL
+#define STYLE2_HONORPROTECTION 0x40UL
+#define STYLE2_CHILDSPANNABLE 0x80UL
+#define STYLE2_DEACTIVATED 0x200UL
+#define STYLE2_NOCONTENTREFERENCE 0x400UL
+#define STYLE2_ADOPTED 0x800UL
+#define STYLE2_NOTUSERDELETEABLE 0x1000UL
+#define STYLE2_EXPANDRIGHT 0x2000UL
+#define STYLE2_EXPANDLEFT 0x4000UL
+#define STYLE2_EXPANDUP 0x8000UL
+#define STYLE2_EXPANDDOWN 0x10000UL
+#define STYLE2_NOTDIRTYABLE 0x20000UL
+#define STYLE2_NONHIERARCHICAL 0x40000UL // Now not used
+#define STYLE2_NOTSIZABLE 0x80000UL
+#define STYLE2_MARGINSSAMEASPARENT 0x100000UL
+#define STYLE2_DISPLAYANCHORPOINTS 0x200000UL
+#define STYLE2_DISPLAYTETHERPOINTS 0x400000UL
+#define STYLE2_SNAPTO 0x800000UL
+#define STYLE2_NOINTERSECTSIBLINGS 0x1000000UL
+#define STYLE2_LOCALCOLUMNINFO 0x2000000UL
+#define STYLE2_INOVERRIDE 0x4000000UL
+#define STYLE2_FROMSTYLE 0x8000000UL
+#define STYLE2_CONTENTFROMSTYLE 0x10000000UL
+#define STYLE2_TEMPORARY 0x20000000UL
+#define STYLE2_JUSTIFIABLE 0x40000000UL
+// Don't assign these flags from one layout to another
+#define STYLE2_DONTASSIGN (STYLE2_DEACTIVATED | \
+ STYLE2_NOCONTENTREFERENCE)
+
+#define STYLE3_ORIGINVALID 0x0001UL
+#define STYLE3_WIDTHVALID 0x0002UL
+#define STYLE3_MINHEIGHTVALID 0x0004UL
+#define STYLE3_STYLELAYOUT 0x0008UL
+#define STYLE3_LINELOCATION1 0x0010UL
+#define STYLE3_LINELOCATION2 0x0020UL
+#define STYLE3_OPENED 0x0040UL
+#define STYLE3_ORIENTSWITHPARENT 0x0080UL
+#define STYLE3_FROZEN 0x0100UL
+#define STYLE3_VALUE_VALID 0x0200UL // moved from CLayout
+#define STYLE3_USEPRINTERSETTINGS 0x0400UL // moved from CLayout
+#define STYLE3_ISAMIPROTABLE 0x0800UL // wrap tables around frames
+ // like Ami Pro
+#define STYLE3_INLINETOMARGIN 0x1000UL // for Croom
+
+#define OVER_PLACEMENT 0x01UL
+#define OVER_SIZE 0x02UL
+#define OVER_MARGINS 0x04UL
+#define OVER_BORDERS 0x08UL
+#define OVER_BACKGROUND 0x10UL
+#define OVER_SHADOW 0x20UL
+#define OVER_JOIN 0x40UL
+#define OVER_COLUMNS 0x80UL
+#define OVER_ROTATION 0x100UL
+#define OVER_SCALING 0x200UL
+#define OVER_NUMERICS 0x400UL
+#define OVER_TABS 0x800UL
+#define OVER_SCRIPT 0x1000UL
+#define OVER_LEADERS 0x2000UL
+#define OVER_ORIENTATION 0x4000UL
+#define OVER_MISC 0x8000UL
+#define OVER_INTERNAL 0x10000UL // User can't access these props.
+
+// the first 4 orientations are left-handed
+// and are simply rotated forms of each other
+#define TEXT_ORIENT_LRTB 0 // left to right, top to bottom
+#define TEXT_ORIENT_TBRL 1 // top to bottom, right to left
+#define TEXT_ORIENT_RLBT 2 // right to left, bottom to top
+#define TEXT_ORIENT_BTLR 3 // bottom to top, left to right
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplaypiece.cxx b/lotuswordpro/source/filter/lwplaypiece.cxx
new file mode 100644
index 000000000..22651e2de
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplaypiece.cxx
@@ -0,0 +1,449 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwplaypiece.hxx"
+#include "lwpstyledef.hxx"
+#include <lwpfilehdr.hxx>
+
+
+LwpRotor::LwpRotor()
+ : m_nRotation(0)
+{}
+
+LwpRotor::~LwpRotor()
+{}
+
+void LwpRotor:: Read(LwpObjectStream *pStrm)
+{
+ m_nRotation = pStrm->QuickReadInt16();
+}
+
+LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+ , m_nWidth(0)
+ , m_nHeight(0)
+ , m_ContentOrientation(0)
+{}
+
+LwpLayoutGeometry::~LwpLayoutGeometry()
+{}
+
+void LwpLayoutGeometry::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_nWidth = m_pObjStrm->QuickReadInt32();
+ m_nHeight = m_pObjStrm->QuickReadInt32();
+ m_Origin.Read(m_pObjStrm.get());
+ m_AbsoluteOrigin.Read(m_pObjStrm.get());
+ m_ContainerRotor.Read(m_pObjStrm.get());
+ m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
+ m_pObjStrm->SkipExtra();
+ }
+}
+void LwpLayoutGeometry::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutScale::LwpLayoutScale(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+ , m_nScaleMode(0)
+ , m_nScalePercentage(0)
+ , m_nScaleWidth(0)
+ , m_nScaleHeight(0)
+ , m_nContentRotation(0)
+ , m_nPlacement(0)
+{}
+
+LwpLayoutScale::~LwpLayoutScale()
+{}
+
+void LwpLayoutScale::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_nScaleMode = m_pObjStrm->QuickReaduInt16();
+ m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
+ m_nScaleWidth = m_pObjStrm->QuickReadInt32();
+ m_nScaleHeight = m_pObjStrm->QuickReadInt32();
+ m_nContentRotation = m_pObjStrm->QuickReaduInt16();
+ m_Offset.Read(m_pObjStrm.get());
+
+ m_nPlacement = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutScale::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutMargins::~LwpLayoutMargins()
+{}
+
+void LwpLayoutMargins::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_Margins.Read(m_pObjStrm.get());
+ m_ExtMargins.Read(m_pObjStrm.get());
+ m_ExtraMargins.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutMargins::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutBorder::~LwpLayoutBorder()
+{}
+
+void LwpLayoutBorder::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_BorderStuff.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutBorder::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutBackground::~LwpLayoutBackground()
+{}
+
+void LwpLayoutBackground::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_BackgroundStuff.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutBackground::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpExternalBorder::LwpExternalBorder()
+{}
+
+LwpExternalBorder::~LwpExternalBorder()
+{}
+
+void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
+{
+ if( LwpFileHeader::m_nFileRevision < 0x000F )
+ return;
+
+ //enum {BORDER,JOIN};
+ m_LeftName.Read(pStrm);
+ m_TopName.Read(pStrm);
+ m_RightName.Read(pStrm);
+ m_BottomName.Read(pStrm);
+ // TODO: Do not know what it is for
+ /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
+ cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
+ cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
+ cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
+ pStrm->SkipExtra();
+}
+
+LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
+{}
+
+void LwpLayoutExternalBorder::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_ExtranalBorder.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutExternalBorder::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpColumnInfo::LwpColumnInfo()
+ : m_nWidth(0)
+ , m_nGap(0)
+{}
+
+LwpColumnInfo::~LwpColumnInfo()
+{}
+
+void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
+{
+ m_nWidth = pStrm->QuickReadInt32();
+ m_nGap = pStrm->QuickReadInt32();
+}
+
+LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+ , m_nNumCols(0)
+{}
+
+LwpLayoutColumns::~LwpLayoutColumns()
+{
+}
+
+void LwpLayoutColumns::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_nNumCols = m_pObjStrm->QuickReaduInt16();
+ m_pColumns.reset( new LwpColumnInfo[m_nNumCols] );
+ for(int i=0; i<m_nNumCols; i++)
+ {
+ m_pColumns[i].Read(m_pObjStrm.get());
+ }
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex)
+{
+ if(nIndex >= m_nNumCols)
+ {
+ return 0;
+ }
+ return m_pColumns[nIndex].GetGap();
+}
+
+void LwpLayoutColumns::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutGutters::~LwpLayoutGutters()
+{}
+
+void LwpLayoutGutters::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_BorderBuffer.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutGutters::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpJoinStuff::LwpJoinStuff()
+ : m_nPercentage(0)
+ , m_nCorners(0)
+ , m_nWidth(0)
+ , m_nHeight(0)
+ , m_nID(0)
+ , m_nScaling(0)
+{}
+
+LwpJoinStuff::~LwpJoinStuff()
+{}
+
+void LwpJoinStuff:: Read(LwpObjectStream *pStrm)
+{
+ m_nWidth = pStrm->QuickReadInt32();
+ m_nHeight = pStrm->QuickReadInt32();
+ m_nPercentage = pStrm->QuickReaduInt16();
+ m_nID = pStrm->QuickReaduInt16();
+ m_nCorners = pStrm->QuickReaduInt16();
+ m_nScaling = pStrm->QuickReaduInt16();
+ m_Color.Read(pStrm);
+ pStrm->SkipExtra();
+
+ // Bug fix: if reading in from something older than Release 9
+ // then check for the external ID and change it to solid.
+ if (LwpFileHeader::m_nFileRevision < 0x0010)
+ {
+ if (m_nID & EXTERNAL_ID)
+ m_nID = MITRE;
+ }
+}
+
+LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutJoins::~LwpLayoutJoins()
+{}
+
+void LwpLayoutJoins::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_JoinStuff.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutJoins::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{}
+
+LwpLayoutShadow::~LwpLayoutShadow()
+{}
+
+void LwpLayoutShadow::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if( LwpFileHeader::m_nFileRevision >= 0x000B )
+ {
+ m_Shadow.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutShadow::Parse(IXFStream* /*pOutputStream*/)
+{}
+
+LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
+ : m_nRelType(LAY_PARENT_RELATIVE),
+ m_nRelFromWhere(LAY_UPPERLEFT),
+ m_nTether(LAY_UPPERLEFT),
+ m_nTetherWhere(LAY_BORDER),
+ m_nFlags(0)
+{
+ m_RelDistance.SetX(0);
+ m_RelDistance.SetY(0);
+}
+/**************************************************************************
+ * @descr: Read LayoutRelativityGuts' information.
+**************************************************************************/
+void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
+{
+ m_nRelType = pStrm->QuickReaduInt8();
+ m_nRelFromWhere = pStrm->QuickReaduInt8();
+ m_RelDistance.Read(pStrm);
+ m_nTether = pStrm->QuickReaduInt8();
+ m_nTetherWhere = pStrm->QuickReaduInt8();
+ if(LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_nFlags = pStrm->QuickReaduInt8();
+ }
+ else
+ {
+ m_nFlags = 0;
+ }
+}
+
+LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpVirtualPiece(objHdr, pStrm)
+{
+}
+
+LwpLayoutRelativity::~LwpLayoutRelativity()
+{
+}
+
+void LwpLayoutRelativity::Read()
+{
+ LwpVirtualPiece::Read();
+ if(LwpFileHeader::m_nFileRevision >= 0x000B)
+ {
+ m_RelGuts.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpLayoutRelativity::Parse(IXFStream * /*pOutputStream*/)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplaypiece.hxx b/lotuswordpro/source/filter/lwplaypiece.hxx
new file mode 100644
index 000000000..d5319ffb2
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplaypiece.hxx
@@ -0,0 +1,368 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYPIECE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYPIECE_HXX
+
+#include "lwppiece.hxx"
+#include <lwpbasetype.hxx>
+#include "lwpmargins.hxx"
+#include "lwpborderstuff.hxx"
+#include "lwpshadow.hxx"
+
+
+class LwpRotor
+{
+public:
+ LwpRotor();
+ ~LwpRotor();
+ void Read(LwpObjectStream *pStrm);
+private:
+ sal_Int16 m_nRotation; //angle
+};
+
+class LwpLayoutGeometry final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutGeometry(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ sal_Int32 GetWidth() const { return m_nWidth; }
+ sal_Int32 GetHeight() const { return m_nHeight; }
+ const LwpPoint& GetOrigin() const { return m_Origin; }
+ const LwpPoint& GetAbsoluteOrigin() const { return m_AbsoluteOrigin; }
+ sal_uInt8 GetContentOrientation() const { return m_ContentOrientation;}
+
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutGeometry() override;
+
+ sal_Int32 m_nWidth;
+ sal_Int32 m_nHeight;
+ LwpPoint m_Origin;
+ LwpPoint m_AbsoluteOrigin;
+ LwpRotor m_ContainerRotor;
+ sal_uInt8 m_ContentOrientation;
+};
+
+class LwpLayoutScale final : public LwpVirtualPiece
+{
+public:
+ enum {ORIGINAL_SIZE = 1, FIT_IN_FRAME = 2, PERCENTAGE = 4,
+ CUSTOM = 8, MAINTAIN_ASPECT_RATIO = 16};
+
+ enum {CENTERED = 1, TILED = 2};
+ LwpLayoutScale(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ sal_uInt16 GetScaleMode() const {return m_nScaleMode;}
+ sal_uInt32 GetScalePercentage() const {return m_nScalePercentage;}
+ sal_Int32 GetScaleWidth() const {return m_nScaleWidth;}
+ sal_Int32 GetScaleHeight() const {return m_nScaleHeight;}
+ sal_uInt16 GetPlacement() const {return m_nPlacement;}
+ LwpPoint& GetOffset() {return m_Offset;}
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutScale() override;
+
+ sal_uInt16 m_nScaleMode;
+ sal_uInt32 m_nScalePercentage;
+ sal_Int32 m_nScaleWidth;
+ sal_Int32 m_nScaleHeight;
+ sal_uInt16 m_nContentRotation;
+ LwpPoint m_Offset;
+ sal_uInt16 m_nPlacement;
+};
+
+class LwpLayoutMargins final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutMargins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpMargins& GetMargins() { return m_Margins; }
+ LwpMargins& GetExtMargins(){ return m_ExtMargins;}
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutMargins() override;
+
+ LwpMargins m_Margins;
+ LwpMargins m_ExtMargins;
+ LwpMargins m_ExtraMargins;
+};
+
+class LwpLayoutBorder final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpBorderStuff& GetBorderStuff(){ return m_BorderStuff;}
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutBorder() override;
+
+ LwpBorderStuff m_BorderStuff;
+};
+
+class LwpLayoutBackground final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutBackground(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpBackgroundStuff& GetBackgoudStuff(){return m_BackgroundStuff;}
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutBackground() override;
+
+ LwpBackgroundStuff m_BackgroundStuff;
+};
+
+class LwpExternalBorder
+{
+public:
+ LwpExternalBorder();
+ ~LwpExternalBorder();
+ void Read(LwpObjectStream *pStrm);
+private:
+ LwpAtomHolder m_LeftName;
+ LwpAtomHolder m_TopName;
+ LwpAtomHolder m_RightName;
+ LwpAtomHolder m_BottomName;
+};
+
+//It seems that this class is used for designer border. Only read now.
+class LwpLayoutExternalBorder final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutExternalBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutExternalBorder() override;
+
+ LwpExternalBorder m_ExtranalBorder;
+};
+
+class LwpColumnInfo
+{
+public:
+ LwpColumnInfo();
+ ~LwpColumnInfo();
+ void Read(LwpObjectStream *pStrm);
+ double GetGap(){return LwpTools::ConvertFromUnitsToMetric(m_nGap);}
+private:
+ sal_Int32 m_nWidth;
+ sal_Int32 m_nGap;
+};
+
+class LwpLayoutColumns final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutColumns(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ sal_uInt16 GetNumCols() const {return m_nNumCols;}
+ double GetColGap(sal_uInt16 nIndex);
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutColumns() override;
+
+ sal_uInt16 m_nNumCols;
+ std::unique_ptr<LwpColumnInfo[]> m_pColumns;
+};
+
+class LwpLayoutGutters final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutGutters(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpBorderStuff& GetBorderStuff() { return m_BorderBuffer; }
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutGutters() override;
+
+ LwpBorderStuff m_BorderBuffer;
+};
+
+class LwpJoinStuff
+{
+public:
+ LwpJoinStuff();
+ ~LwpJoinStuff();
+ void Read(LwpObjectStream *pStrm);
+private:
+ sal_uInt16 m_nPercentage;
+ sal_uInt16 m_nCorners;
+ sal_Int32 m_nWidth;
+ sal_Int32 m_nHeight;
+
+ enum JoinType
+ {
+ MITRE = 1,
+ NEGATE = 2,
+ ROUNDED = 3,
+ RECTANGLE = 4,
+ SPECIAL = 5,
+ DIAGONAL = 6,
+ NEGATE_NO_CROSS = 7,
+ DOG_EAR_PAGE = 8,
+ DESKTOP = 9,
+ BOX_HIGHLIGHT = 10,
+ STAR = 11,
+ ROPE = 12,
+ DECO1 = 13,
+ DECO2 = 14,
+ RAIN = 15,
+ PIN = 16,
+ ROSE = 17,
+ SUNF = 18,
+ DECO3 = 19,
+ WARNING = 20,
+ BUBBLE = 21,
+ GIRDER = 22,
+ SMILE = 23,
+ ARROW = 24,
+ MAXJOIN = 24
+ };
+
+ sal_uInt16 m_nID;//JoinType
+ sal_uInt16 m_nScaling;
+ LwpColor m_Color;
+};
+
+class LwpLayoutJoins final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutJoins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutJoins() override;
+
+ LwpJoinStuff m_JoinStuff;
+};
+
+class LwpLayoutShadow final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutShadow(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpShadow& GetShadow() { return m_Shadow; }
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutShadow() override;
+
+ LwpShadow m_Shadow;
+};
+
+class LwpLayoutRelativityGuts
+{
+public:
+ LwpLayoutRelativityGuts();
+ void Read(LwpObjectStream *pStrm);
+ sal_uInt8 GetRelativeType() const { return m_nRelType;}
+ enum RelativeType
+ {
+ LAY_PARENT_RELATIVE = 1,
+ LAY_PARA_RELATIVE,
+ LAY_INLINE,
+ LAY_INLINE_NEWLINE,
+ LAY_CONTENT_RELATIVE,
+ LAY_INLINE_VERTICAL
+ };
+ enum WhereType
+ {
+ LAY_UPPERLEFT = 1,
+ LAY_MIDDLETOP,
+ LAY_UPPERRIGHT,
+ LAY_MIDDLELEFT,
+ LAY_MIDDLERIGHT,
+ LAY_LOWERLEFT,
+ LAY_MIDDLEBOTTOM,
+ LAY_LOWERRIGHT,
+ LAY_MIDDLE
+ };
+ enum TetherWhereType
+ {
+ LAY_INTERNAL = 1,
+ LAY_EXTERNAL,
+ LAY_BORDER
+ };
+private:
+ sal_uInt8 m_nRelType;
+ sal_uInt8 m_nRelFromWhere;
+ LwpPoint m_RelDistance;
+ sal_uInt8 m_nTether;
+ sal_uInt8 m_nTetherWhere;
+ sal_uInt8 m_nFlags;
+};
+
+class LwpLayoutRelativity final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutRelativity(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpLayoutRelativityGuts& GetRelGuts() { return m_RelGuts; }
+private:
+ virtual void Read() override;
+ virtual ~LwpLayoutRelativity() override;
+
+ LwpLayoutRelativityGuts m_RelGuts;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplnopts.cxx b/lotuswordpro/source/filter/lwplnopts.cxx
new file mode 100644
index 000000000..f06774ad1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplnopts.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpglobalmgr.hxx>
+#include "lwplnopts.hxx"
+
+LwpLineNumberOptions::LwpLineNumberOptions(LwpObjectStream* pStrm)
+{
+ Read(pStrm);
+}
+/**
+ * @descr Read LwpLineNumberOptions from object stream
+ */
+void LwpLineNumberOptions::Read(LwpObjectStream *pStrm)
+{
+ m_nType = pStrm->QuickReaduInt16();
+ m_nFlags = pStrm->QuickReaduInt16();
+ m_nSeparator = pStrm->QuickReaduInt16();
+ m_nSpacing = pStrm->QuickReaduInt32();
+ m_nDistance = pStrm->QuickReaduInt32();
+ pStrm->SkipExtra();
+}
+/**
+ * @descr set XFLineNumberConfig
+ */
+void LwpLineNumberOptions::RegisterStyle()
+{
+ if (m_nType == NUMBER_NONE)
+ return;
+ XFLineNumberConfig* pLineNumber = new XFLineNumberConfig;
+ pLineNumber->SetNumberPosition(enumXFLineNumberLeft);
+ pLineNumber->SetNumberOffset(LwpTools::ConvertFromUnitsToMetric(m_nDistance));
+ pLineNumber->SetNumberIncrement(m_nSeparator);
+ if (m_nFlags & LN_RESETEACHPAGE)
+ pLineNumber->SetRestartOnPage();
+ else
+ pLineNumber->SetRestartOnPage(false);
+ if (m_nFlags & LN_COUNTBLANKLINES)
+ pLineNumber->SetCountEmptyLines();
+ else
+ pLineNumber->SetCountEmptyLines(false);
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->SetLineNumberConfig(pLineNumber);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwplnopts.hxx b/lotuswordpro/source/filter/lwplnopts.hxx
new file mode 100644
index 000000000..a861b311b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwplnopts.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLNOPTS_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLNOPTS_HXX
+
+#include <lwpobjstrm.hxx>
+
+/**
+ * @brief line number options
+*/
+class LwpLineNumberOptions final
+{
+public:
+ explicit LwpLineNumberOptions(LwpObjectStream* pStrm);
+private:
+ sal_uInt16 m_nType;
+ sal_uInt16 m_nFlags;
+ sal_uInt16 m_nSeparator;
+ sal_uInt32 m_nSpacing;
+ sal_uInt32 m_nDistance;
+public:
+ enum
+ {
+ NUMBER_NONE, NUMBER_LINES, NUMBER_TEXTLINESONLY
+ };
+ enum
+ {
+ LN_RESETEACHPAGE = 0x01,
+ LN_COUNTBLANKLINES = 0x02
+ };
+ void Read(LwpObjectStream *pStrm);
+ void RegisterStyle();
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpmargins.hxx b/lotuswordpro/source/filter/lwpmargins.hxx
new file mode 100644
index 000000000..7095b3b81
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpmargins.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPMARGINS_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPMARGINS_HXX
+
+#include <lwpobjstrm.hxx>
+#include <lwptools.hxx>
+
+const sal_uInt8 MARGIN_LEFT = 0;
+const sal_uInt8 MARGIN_RIGHT = 1;
+const sal_uInt8 MARGIN_TOP = 2;
+const sal_uInt8 MARGIN_BOTTOM = 3;
+
+class LwpMargins
+{
+public:
+ LwpMargins():m_nLeft(0),m_nTop(0),m_nRight(0),m_nBottom(0){}
+public:
+ void Read(LwpObjectStream *pStrm)
+ {
+ m_nLeft = pStrm->QuickReadInt32();
+ m_nTop = pStrm->QuickReadInt32();
+ m_nRight = pStrm->QuickReadInt32();
+ m_nBottom = pStrm->QuickReadInt32();
+ pStrm->SkipExtra();
+ }
+ inline double GetMarginsValue(sal_uInt8 nWhichSide);
+private:
+ sal_Int32 m_nLeft;
+ sal_Int32 m_nTop;
+ sal_Int32 m_nRight;
+ sal_Int32 m_nBottom;
+};
+
+inline double LwpMargins::GetMarginsValue(sal_uInt8 nWhichSide)
+{
+ switch (nWhichSide)
+ {
+ case MARGIN_LEFT://left
+ return LwpTools::ConvertFromUnitsToMetric(m_nLeft);
+ case MARGIN_RIGHT://right
+ return LwpTools::ConvertFromUnitsToMetric(m_nRight);
+ case MARGIN_TOP://top
+ return LwpTools::ConvertFromUnitsToMetric(m_nTop);
+ case MARGIN_BOTTOM://bottom
+ return LwpTools::ConvertFromUnitsToMetric(m_nBottom);
+ }
+ // FIXME: this is needed to avoid warning: control reaches end of non-void function
+ // a better solution would be to enum value for the parameter side
+ return 0;
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx
new file mode 100644
index 000000000..9f71b3e7b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpmarker.cxx
@@ -0,0 +1,538 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpfoundry.hxx>
+#include <lwpfilehdr.hxx>
+#include "lwpstory.hxx"
+#include "lwpmarker.hxx"
+#include "lwpproplist.hxx"
+#include <lwpglobalmgr.hxx>
+#include <xfilter/xfplaceholder.hxx>
+#include <xfilter/xfinputlist.hxx>
+
+LwpMarker::LwpMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpDLNFPVList(objHdr,pStrm)
+ , m_nFlag(0)
+ , m_nPageNumber(0)
+ , m_nNeedUpdate(0)
+{
+}
+
+void LwpMarker::Read()
+{
+ LwpDLNFPVList::Read();
+ m_objContent.ReadIndexed(m_pObjStrm.get());
+ m_objLayout.ReadIndexed(m_pObjStrm.get());
+ m_objMarkerList.ReadIndexed(m_pObjStrm.get());
+ m_nNeedUpdate = m_pObjStrm->QuickReaduInt16();
+ m_nFlag = m_pObjStrm->QuickReaduInt16();
+ m_nPageNumber = m_pObjStrm->QuickReaduInt16();
+
+ m_pObjStrm->SkipExtra();
+}
+
+OUString LwpMarker::GetNamedProperty(const OUString& name)
+{
+ LwpPropList* pProp = GetPropList();
+ if (pProp)
+ return pProp->GetNamedProperty(name);
+ else
+ return OUString();
+}
+
+LwpStoryMarker::LwpStoryMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpMarker(objHdr,pStrm)
+ , m_nFlag(0)
+{
+}
+
+void LwpStoryMarker::Read()
+{
+ LwpMarker::Read();
+ m_nFlag = m_pObjStrm->QuickReaduInt16();
+ m_Range.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpFribRange::Read(LwpObjectStream* pObjStrm)
+{
+ m_StartPara.ReadIndexed(pObjStrm);
+ m_EndPara.ReadIndexed(pObjStrm);
+}
+
+LwpCHBlkMarker::LwpCHBlkMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpStoryMarker(objHdr, pStrm)
+ , m_nTab(0)
+ , m_nFlag(0)
+ , m_nAction(0)
+{
+}
+
+void LwpCHBlkMarker::Read()
+{
+ LwpStoryMarker::Read();
+ m_objPromptStory.ReadIndexed(m_pObjStrm.get());
+ m_Help.Read(m_pObjStrm.get());
+ m_nAction = m_pObjStrm->QuickReaduInt16();
+ m_nTab = m_pObjStrm->QuickReaduInt32();
+ m_nFlag = m_pObjStrm->QuickReaduInt16();
+ if(m_pObjStrm->CheckExtra())
+ {
+ m_Mirror.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+OUString LwpCHBlkMarker::GetPromptText() const
+{
+ LwpStory* pStory = nullptr;
+ if (m_objPromptStory.obj().is())
+ pStory = dynamic_cast<LwpStory*>(m_objPromptStory.obj().get());
+ if (pStory)
+ return pStory->GetContentText();
+ return OUString();
+}
+
+void LwpCHBlkMarker::ConvertCHBlock(XFContentContainer* pXFPara, sal_uInt8 nType)
+{
+ sal_uInt16 nAction = GetAction();
+
+ switch(nAction)
+ {
+ case CLICKHERE_CHBEHAVIORTEXT:
+ case CLICKHERE_CHBEHAVIORTABLE:
+ case CLICKHERE_CHBEHAVIORPICTURE:
+ case CLICKHERE_CHBEHAVIOROLEOBJECT:
+ ProcessPlaceHolder(pXFPara,nAction,nType);
+ break;
+ case CLICKHERE_CHBEHAVIORCHART:
+ case CLICKHERE_CHBEHAVIORDRAWING:
+ case CLICKHERE_CHBEHAVIORGLOSSARY:
+ case CLICKHERE_CHBEHAVIOREQUATION:
+ case CLICKHERE_CHBEHAVIORSYMBOL:
+ case CLICKHERE_CHBEHAVIORPAGENUM:
+ case CLICKHERE_CHBEHAVIORDOCFIELD:
+ case CLICKHERE_CHBEHAVIORDATETIME:
+ ProcessOtherCHB(pXFPara,nType);
+ break;
+ case CLICKHERE_CHBEHAVIORSTRINGLIST:
+ ProcessKeylist(pXFPara,nType);
+ break;
+ default:
+ break;
+ }
+}
+
+void LwpCHBlkMarker::ProcessPlaceHolder(XFContentContainer* pXFPara,sal_uInt16 nAction,
+ sal_uInt8 nType)
+{
+ bool bFillFlag = IsHasFilled();
+ bool bHelpFlag = IsBubbleHelp();
+
+ if ( bFillFlag )
+ return;
+ if (nType == MARKER_START)
+ {
+ XFHolderStart* pHolder= new XFHolderStart;
+ switch(nAction)
+ {
+ case CLICKHERE_CHBEHAVIORTEXT:
+ pHolder->SetType("text");
+ break;
+ case CLICKHERE_CHBEHAVIORTABLE:
+ pHolder->SetType("table");
+ break;
+ case CLICKHERE_CHBEHAVIORPICTURE:
+ pHolder->SetType("image");
+ break;
+ case CLICKHERE_CHBEHAVIOROLEOBJECT:
+ pHolder->SetType("object");
+ break;
+ default:
+ break;
+ }
+
+ if (bHelpFlag)
+ pHolder->SetDesc(m_Help.str());
+ pHolder->SetPrompt(GetPromptText());
+ pXFPara->Add(pHolder);
+ }
+ else if (nType == MARKER_END)
+ {
+ XFHolderEnd* pHolder = new XFHolderEnd;
+ pXFPara->Add(pHolder);
+ }
+}
+
+void LwpCHBlkMarker::ProcessOtherCHB(XFContentContainer* pXFPara,sal_uInt8 nType)
+{
+ bool bFillFlag = IsHasFilled();
+ bool bHelpFlag = IsBubbleHelp();
+
+ if ( bFillFlag )
+ return;
+ if (nType == MARKER_START)
+ {
+ XFHolderStart* pHolder= new XFHolderStart;
+ pHolder->SetType("text");
+ if (bHelpFlag)
+ pHolder->SetDesc(m_Help.str());
+ pHolder->SetPrompt(GetPromptText());
+ pXFPara->Add(pHolder);
+ }
+ else if (nType == MARKER_END)
+ {
+ XFHolderEnd* pHolder = new XFHolderEnd;
+ pXFPara->Add(pHolder);
+ }
+
+}
+
+//note: there will be a blank to mark the list
+//all input content of key list processed as normal text
+void LwpCHBlkMarker::ProcessKeylist(XFContentContainer* pXFPara,sal_uInt8 nType)
+{
+ bool bFillFlag = IsHasFilled();
+
+ if ( bFillFlag )
+ {
+ if (nType == MARKER_START)
+ {
+ EnumAllKeywords();//traverse the proplist to find all keywords
+ XFInputList* pList = new XFInputList;
+ pList->SetName(LwpDLNFPVList::m_Name.str());
+ pList->SetLabels(m_Keylist);
+ pXFPara->Add(pList);
+ }
+ // else skip MARKER_END
+ }
+ else
+ {
+ if (nType == MARKER_START)
+ {
+ EnumAllKeywords();
+ XFInputList* pList = new XFInputList;
+ pList->SetName(LwpDLNFPVList::m_Name.str());
+ pList->SetLabels(m_Keylist);
+ pXFPara->Add(pList);
+
+ XFHolderStart* pHolder= new XFHolderStart;
+ pHolder->SetType("text");
+ pHolder->SetPrompt(GetPromptText());
+ pXFPara->Add(pHolder);
+ }
+ else if (nType == MARKER_END)
+ {
+ XFHolderEnd* pHolder = new XFHolderEnd;
+ pXFPara->Add(pHolder);
+ }
+ }
+}
+
+bool LwpCHBlkMarker::IsHasFilled() const
+{
+ return (CHB_PROMPT & m_nFlag) == 0;
+}
+
+bool LwpCHBlkMarker::IsBubbleHelp() const
+{
+ return (CHB_HELP & m_nFlag) != 0;
+}
+
+void LwpCHBlkMarker::EnumAllKeywords()
+{
+ OUString name1("");
+ OUString value1("");
+ OUString name2("start");
+ LwpPropList* pProp = GetPropList();
+ if (!pProp)
+ return;
+ while(!name2.isEmpty())
+ {
+ name2 = pProp->EnumNamedProperty(name1,value1);
+ if ( name1.match("LIST",0) )
+ {
+ m_Keylist.push_back(value1);
+ }
+ name1 = name2;
+ }
+}
+
+LwpBookMark::LwpBookMark(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpDLNFVList(objHdr,pStrm)
+ , m_nFlag(0)
+{
+}
+
+void LwpBookMark::Read()
+{
+ LwpDLNFVList::Read();
+ m_objMarker.ReadIndexed(m_pObjStrm.get());
+ if (LwpFileHeader::m_nFileRevision < 0x0008)
+ {
+ if (m_pObjStrm->QuickReadBool())
+ m_nFlag |= BKMK_NOTESFX;
+ }
+ else
+ m_nFlag = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+}
+
+bool LwpBookMark::IsRightMarker(LwpObjectID objMarker)
+{
+ return objMarker == m_objMarker;
+}
+
+OUString const & LwpBookMark::GetName()
+{
+ return LwpDLNFVList::GetName().str();
+}
+
+LwpFieldMark::LwpFieldMark(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpStoryMarker(objHdr,pStrm)
+ , m_nFlag(0)
+ , m_nFieldType(0)
+ , m_bHasStyle(false)
+ , m_bHasStart(false)
+ , m_pFrib(nullptr)
+ , m_bRevisionFlag(false)
+{
+}
+
+void LwpFieldMark::Read()
+{
+ LwpStoryMarker::Read();
+ m_Formula.Read(m_pObjStrm.get());
+ m_objFormulaStory.ReadIndexed(m_pObjStrm.get());
+ if (LwpFileHeader::m_nFileRevision < 0x000B)
+ return;
+ m_objResultContent.ReadIndexed(m_pObjStrm.get());
+ m_nFlag = m_pObjStrm->QuickReaduInt16();
+ m_nFieldType = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpFieldMark::ParseIndex(OUString& sKey1,OUString& sKey2)
+{
+ OUString sFormula = m_Formula.str();
+ sal_Int32 index[4];
+ sal_Unicode ch(0x0022);//"
+ index[0] = sFormula.indexOf(ch);
+ index[1] = sFormula.indexOf(ch,index[0]+1);
+
+ index[2] = sFormula.indexOf(ch,index[1]+1);
+ index[3] = sFormula.indexOf(ch,index[2]+1);
+ if (index[0]>=0 && index[1]>=0)
+ sKey1 = sFormula.copy(index[0]+1,index[1]-index[0]-1);
+ else
+ sKey1.clear();
+ if (index[2]>=0 && index[3]>=0)
+ sKey2 = sFormula.copy(index[2]+1,index[3]-index[2]-1);
+ else
+ sKey2.clear();
+}
+
+void LwpFieldMark::ParseTOC(OUString& sLevel,OUString& sText)
+{
+ OUString sFormula = m_Formula.str();
+ sal_Int32 index[4];
+ sal_Unicode ch1(0x0020);//space
+ sal_Unicode ch2(0x0022);//"
+
+ index[0] = sFormula.indexOf(ch1);
+ index[1] = sFormula.indexOf(ch1,index[0]+1);
+
+ index[2] = sFormula.indexOf(ch2,index[1]+1);
+ index[3] = sFormula.indexOf(ch2,index[2]+1);
+ if (index[0]>=0 && index[1]>=0)
+ sLevel = sFormula.copy(index[0]+1,index[1]-index[0]-1);
+ else
+ sLevel.clear();
+ if (index[2]>=0 && index[3]>=0)
+ sText = sFormula.copy(index[2]+1,index[3]-index[2]-1);
+ else
+ sText.clear();
+}
+
+bool LwpFieldMark::IsFormulaInsert() const
+{
+ return (m_nFlag & FF_FORMULAINSERTED) != 0;
+}
+
+bool LwpFieldMark::IsDateTimeField(sal_uInt8& type,OUString& formula)
+{
+ OUString sFormula = m_Formula.str();
+ sal_Int32 index = sFormula.indexOf(0x20); // space
+ if (index < 0)
+ {
+ if (sFormula == "TotalEditingTime")
+ {
+ type = DATETIME_TOTALTIME;
+ return true;
+ }
+ return false;
+ }
+
+ OUString tag = sFormula.copy(0,index);
+ if (tag == "Now()")
+ {
+ type = DATETIME_NOW;
+ formula = sFormula.copy(index+1);
+ return true;
+ }
+ else if (tag == "CreateDate")
+ {
+ type = DATETIME_CREATE;
+ formula = sFormula.copy(index+1);
+ return true;
+ }
+ else if (tag == "EditDate")
+ {
+ type = DATETIME_LASTEDIT;
+ formula = sFormula.copy(index+1);
+ return true;
+ }
+ else if (tag == "YesterdaysDate" || tag == "TomorrowsDate"
+ || tag == "TodaysDate")
+ {
+ type = DATETIME_SKIP;
+ return true;
+ }
+ else
+ return false;
+}
+
+bool LwpFieldMark::IsCrossRefField(sal_uInt8& nType, OUString& sMarkName)
+{
+ OUString sFormula = m_Formula.str();
+ sal_Int32 index = sFormula.indexOf(0x20); // space
+ if (index < 0)
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpBookmarkMgr* pMarkMgr = pGlobal->GetLwpBookmarkMgr();
+ if (pMarkMgr->FindBookmark(sFormula))
+ {
+ sMarkName = sFormula;
+ nType = CROSSREF_TEXT;
+ return true;
+ }
+ else
+ return false;
+ }
+
+ OUString tag = sFormula.copy(0,index);
+ if (tag == "PageRef")
+ {
+ sMarkName = sFormula.copy(index+1);
+ nType = CROSSREF_PAGE;
+ return true;
+ }
+ else if (tag == "ParaRef")
+ {
+ sMarkName = sFormula.copy(index+1);
+ nType = CROSSREF_PARANUMBER;
+ return true;
+ }
+ else
+ return false;
+}
+
+bool LwpFieldMark::IsDocPowerField(sal_uInt8& nType,OUString& sFormula)
+{
+ sFormula = m_Formula.str();
+
+ if (sFormula == "Description")
+ {
+ nType = DOC_DESCRIPTION;
+ return true;
+ }
+ else if (sFormula == "NumPages")
+ {
+ nType = DOC_NUMPAGES;
+ return true;
+ }
+ else if (sFormula == "NumChars")
+ {
+ nType = DOC_NUMCHARS;
+ return true;
+ }
+ else if (sFormula == "NumWords")
+ {
+ nType = DOC_NUMWORDS;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+LwpRubyMarker::LwpRubyMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm):LwpStoryMarker(objHdr,pStrm)
+{
+}
+
+void LwpRubyMarker::Read()
+{
+ LwpStoryMarker::Read();
+ m_objLayout.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpmarker.hxx b/lotuswordpro/source/filter/lwpmarker.hxx
new file mode 100644
index 000000000..2a94aaaa2
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpmarker.hxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPMARKER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPMARKER_HXX
+
+#include <lwpobjid.hxx>
+#include "lwpdlvlist.hxx"
+#include <lwpfrib.hxx>
+
+class LwpMarker : public LwpDLNFPVList
+{
+public:
+ LwpMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+ void Read() override;
+ OUString GetNamedProperty(const OUString& name);
+protected:
+ enum{
+ MARKER_START=1,
+ MARKER_END=2
+ };
+private:
+ sal_uInt16 m_nFlag;
+ sal_uInt16 m_nPageNumber;
+ sal_uInt16 m_nNeedUpdate;
+ LwpObjectID m_objLayout;
+ LwpObjectID m_objMarkerList;
+ LwpObjectID m_objContent;
+
+};
+
+class LwpFribRange
+{
+public:
+ LwpFribRange(){}
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpObjectID m_StartPara;
+ LwpObjectID m_EndPara;
+};
+
+class LwpStoryMarker : public LwpMarker
+{
+public:
+ LwpStoryMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+ void Read() override;
+private:
+ LwpFribRange m_Range;
+ sal_uInt16 m_nFlag;
+};
+
+class LwpCHBlkMarker : public LwpStoryMarker
+{
+public:
+ LwpCHBlkMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+ void Read() override;
+ sal_uInt16 GetAction() const {return m_nAction;}
+ void ConvertCHBlock(XFContentContainer* pXFPara,sal_uInt8 nType);
+ enum{
+ CLICKHERE_CHBEHAVIORTEXT=1,
+ CLICKHERE_CHBEHAVIORTABLE=2,
+ CLICKHERE_CHBEHAVIORPICTURE=3,
+ CLICKHERE_CHBEHAVIOROLEOBJECT=4,
+ CLICKHERE_CHBEHAVIORCHART=5,
+ CLICKHERE_CHBEHAVIORDRAWING=6,
+ CLICKHERE_CHBEHAVIORFILE=7,
+ CLICKHERE_CHBEHAVIORGLOSSARY=8,
+ CLICKHERE_CHBEHAVIOREQUATION=9,
+ CLICKHERE_CHBEHAVIORINTERNETLINK=10,
+ CLICKHERE_CHBEHAVIORSTRINGLIST=11,
+ CLICKHERE_CHBEHAVIORDATETIME=12,
+ CLICKHERE_CHBEHAVIORSYMBOL=13,
+ CLICKHERE_CHBEHAVIORDOCFIELD=14,
+ CLICKHERE_CHBEHAVIORPAGENUM=15
+ };
+private:
+ void ProcessPlaceHolder(XFContentContainer* pXFPara,sal_uInt16 nAction,sal_uInt8 nType);
+ void ProcessOtherCHB(XFContentContainer* pXFPara,sal_uInt8 nType);
+ void ProcessKeylist(XFContentContainer* pXFPara,sal_uInt8 nType);
+ bool IsHasFilled() const;
+ bool IsBubbleHelp() const;
+ OUString GetPromptText() const;
+ void EnumAllKeywords();
+private:
+ enum{
+ CHB_PROMPT = 0x01,
+ CHB_EDIT = 0x02,
+ CHB_HELP = 0x04,
+ CHB_TAB = 0x08,
+ CHB_HIDDEN = 0x10,
+ CHB_ALLOWVALUESNOTINLIST = 0x20,
+ CHB_ALLOWMULTIVALUES = 0x40,
+ CHB_RETURN = 0x80,
+ CHB_NOEARS = 0x100,
+ CHB_MAGNETIC = 0x200,
+ CHB_PERSISTENT = (CHB_PROMPT+CHB_HELP+CHB_TAB+CHB_HIDDEN
+ +CHB_ALLOWVALUESNOTINLIST+CHB_ALLOWMULTIVALUES
+ +CHB_RETURN+CHB_NOEARS+CHB_MAGNETIC)
+ };
+ LwpObjectID m_objPromptStory;
+ sal_uInt32 m_nTab;
+ sal_uInt16 m_nFlag;
+ sal_uInt16 m_nAction;
+ LwpAtomHolder m_Help;
+ LwpAtomHolder m_Mirror;
+ std::vector<OUString> m_Keylist;
+};
+
+class LwpBookMark : public LwpDLNFVList
+{
+public:
+ LwpBookMark(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+protected:
+ void Read() override;
+public:
+ bool IsRightMarker(LwpObjectID objMarker);
+ OUString const & GetName();
+private:
+ enum { BKMK_NOTESFX = 0x0001,
+ BKMK_OLDNOTESFX = 0x0002
+ };
+ LwpObjectID m_objMarker;
+ sal_uInt16 m_nFlag;
+};
+
+class LwpFieldMark : public LwpStoryMarker
+{
+public:
+ LwpFieldMark(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+ void Read() override;
+ void ParseIndex(OUString& sKey1,OUString& sKey2);
+ void ParseTOC(OUString& sLevel,OUString& sText);
+ sal_uInt16 GetFieldType() const {return m_nFieldType;}
+ bool IsFormulaInsert() const;
+ bool IsDateTimeField(sal_uInt8& type,OUString& formula);
+ bool IsCrossRefField(sal_uInt8& nType, OUString& sMarkName);
+ bool IsDocPowerField(sal_uInt8& nType,OUString& sFormula);
+ OUString const & GetFormula() const {return m_Formula.str();}
+ void SetStyleFlag(bool bFalg){m_bHasStyle = bFalg;}
+ bool GetStyleFlag() const {return m_bHasStyle;}
+ bool GetStart() const {return m_bHasStart;}
+ void SetStart(bool bFlag){m_bHasStart = bFlag;}
+ LwpFrib* GetStartFrib(){return m_pFrib;}
+ void SetStartFrib(LwpFrib* pFrib){m_pFrib = pFrib;}
+ bool GetRevisionFlag() const {return m_bRevisionFlag;}
+ void SetRevisionFlag(bool bFlag){m_bRevisionFlag = bFlag;}
+
+ enum{
+ FLD_FIELD = 0x0003,
+ FLD_INDEX = 0x0008,
+ FLD_TOC = 0x000B
+ };
+ enum{
+ FF_FORMULAINSERTED = 0X0008,
+ };
+ enum{
+ CROSSREF_INVALID = 0,
+ CROSSREF_TEXT = 1,
+ CROSSREF_PAGE = 2,
+ CROSSREF_PARANUMBER = 3
+ };
+ enum{
+ DATETIME_SKIP = 0,
+ DATETIME_NOW = 1,
+ DATETIME_CREATE = 2,
+ DATETIME_LASTEDIT = 3,
+ DATETIME_TOTALTIME = 4
+ };
+ enum{
+ DOC_DESCRIPTION = 1,
+ DOC_NUMPAGES = 2,
+ DOC_NUMWORDS = 3,
+ DOC_NUMCHARS = 4,
+ };
+private:
+ LwpObjectID m_objFormulaStory;
+ LwpObjectID m_objResultContent;
+ sal_uInt16 m_nFlag;
+ sal_uInt16 m_nFieldType;
+ LwpAtomHolder m_Formula;
+
+ bool m_bHasStyle;
+ bool m_bHasStart;
+
+ LwpFrib* m_pFrib;
+ bool m_bRevisionFlag;
+};
+
+class LwpRubyMarker : public LwpStoryMarker
+{
+public:
+ LwpRubyMarker(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+ void Read() override;
+ const OUString& GetRubyText() const {return m_strRubyText;}
+ void SetRubyText(const OUString& sText){m_strRubyText = sText;}
+ const OUString& GetTextStyleName() const {return m_TextStyle;}
+ void SetTextStyleName(const OUString& sName){m_TextStyle = sName;}
+ const OUString& GetRubyStyleName() const {return m_RubyStyle;}
+ void SetRubyStyleName(const OUString& sName){m_RubyStyle = sName;}
+private:
+ LwpObjectID m_objLayout;
+ OUString m_strRubyText;
+ OUString m_RubyStyle;
+ OUString m_TextStyle;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx
new file mode 100644
index 000000000..db25f3e3a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpnotes.cxx
@@ -0,0 +1,324 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - notes
+ */
+
+#include "lwpnotes.hxx"
+#include "lwppara.hxx"
+#include <xfilter/xfannotation.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <localtime.hxx>
+#include <lwptools.hxx>
+
+ LwpFribNote::LwpFribNote(LwpPara* pPara ):LwpFrib(pPara)
+{
+}
+
+/**
+ * @descr read frib information
+ */
+void LwpFribNote::Read(LwpObjectStream *pObjStrm, sal_uInt16 /*len*/)
+{
+ m_Layout.ReadIndexed(pObjStrm);
+}
+
+/**
+ * @descr Register style
+ */
+void LwpFribNote::RegisterNewStyle()
+{
+ rtl::Reference<LwpObject> pLayout = m_Layout.obj();
+ if(pLayout.is())
+ {
+ //register font style
+ LwpFrib::RegisterStyle(m_pPara->GetFoundry());
+ //register foonote style
+ pLayout->SetFoundry(m_pPara->GetFoundry());
+ pLayout->DoRegisterStyle();
+ }
+}
+
+/**
+ * @descr convert note
+ */
+void LwpFribNote::XFConvert(XFContentContainer* pCont)
+{
+ LwpNoteLayout* pLayout = dynamic_cast<LwpNoteLayout*>(m_Layout.obj().get());
+ if(!pLayout)
+ return;
+
+ XFAnnotation* pXFNote = new XFAnnotation;
+ pXFNote->SetAuthor(pLayout->GetAuthor());
+ LtTm aTm;
+ long nTime = pLayout->GetTime();
+ if(LtgLocalTime(nTime, aTm))
+ {
+ pXFNote->SetDate(LwpTools::DateTimeToOUString(aTm));
+ }
+
+ pLayout->XFConvert(pXFNote);
+ if(m_pModifiers)
+ {
+ XFTextSpan *pSpan = new XFTextSpan();
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pXFNote);
+ pCont->Add(pSpan);
+ }
+ else
+ {
+ pCont->Add(pXFNote);
+ }
+
+}
+
+LwpNoteLayout::LwpNoteLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpFrameLayout(objHdr, pStrm)
+ , m_nTime(0)
+{
+}
+
+LwpNoteLayout::~LwpNoteLayout()
+{
+
+}
+
+/**
+ * @descr read note layout object
+ *
+ */
+void LwpNoteLayout::Read()
+{
+ LwpFrameLayout::Read();
+
+ m_nTime = m_pObjStrm->QuickReaduInt32();
+ m_UserName.Read(m_pObjStrm.get());
+
+ LwpAtomHolder aUserInitials;
+ aUserInitials.Read(m_pObjStrm.get());
+
+ LwpColor aColor;
+ aColor.Read(m_pObjStrm.get());
+
+ // vacant note sequence
+ m_pObjStrm->QuickReadInt32();
+
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register style
+ */
+void LwpNoteLayout::RegisterStyle()
+{
+ LwpVirtualLayout* pTextLayout = GetTextLayout();
+ if(pTextLayout)
+ {
+ pTextLayout->SetFoundry(GetFoundry());
+ pTextLayout->DoRegisterStyle();
+ }
+}
+
+/**
+ * @descr convert note
+ */
+void LwpNoteLayout::XFConvert(XFContentContainer * pCont)
+{
+ LwpVirtualLayout* pTextLayout = GetTextLayout();
+ if(pTextLayout)
+ {
+ pTextLayout->DoXFConvert(pCont);
+ }
+}
+
+/**
+ * @descr Get layout that contains note text.
+ */
+LwpVirtualLayout* LwpNoteLayout::GetTextLayout()
+{
+ LwpVirtualLayout* pLayout = FindChildByType(LWP_VIEWPORT_LAYOUT);
+ if(pLayout)
+ {
+ return pLayout->FindChildByType(LWP_NOTETEXT_LAYOUT);
+ }
+
+ return nullptr;
+}
+/**
+ * @descr Get author.
+ */
+OUString LwpNoteLayout::GetAuthor()
+{
+ if(m_UserName.HasValue())
+ {
+ if(m_UserName.str() != " ")
+ {
+ return m_UserName.str();
+ }
+ }
+ //if username is null or writerspace, get username from noteheaderlayout
+ LwpNoteHeaderLayout* pTextLayout = static_cast<LwpNoteHeaderLayout*>(FindChildByType(LWP_NOTEHEADER_LAYOUT));
+ if(pTextLayout)
+ {
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
+ if(pStory)
+ {
+ LwpPara* pFirst = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+ if(pFirst)
+ return pFirst->GetContentText(true);
+ }
+ }
+
+ return m_UserName.str();
+}
+
+LwpNoteHeaderLayout::LwpNoteHeaderLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpFrameLayout(objHdr, pStrm)
+{
+}
+
+LwpNoteHeaderLayout::~LwpNoteHeaderLayout()
+{
+}
+
+/**
+ * @descr read note layout object
+ *
+ */
+void LwpNoteHeaderLayout::Read()
+{
+ LwpFrameLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpNoteHeaderLayout::RegisterStyle()
+{
+}
+
+void LwpNoteHeaderLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+LwpNoteTextLayout::LwpNoteTextLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpFrameLayout(objHdr, pStrm)
+{
+}
+
+LwpNoteTextLayout::~LwpNoteTextLayout()
+{
+}
+
+/**
+ * @descr read note layout object
+ *
+ */
+void LwpNoteTextLayout::Read()
+{
+ LwpFrameLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr Register style, SODC doesn't support text style in note
+ */
+void LwpNoteTextLayout::RegisterStyle()
+{
+ rtl::Reference<LwpObject> pContent = m_Content.obj();
+ if(pContent.is())
+ {
+ pContent->SetFoundry(GetFoundry());
+ pContent->DoRegisterStyle();
+ }
+}
+
+void LwpNoteTextLayout::XFConvert(XFContentContainer * pCont)
+{
+ rtl::Reference<LwpObject> pContent = m_Content.obj();
+ if(pContent.is())
+ {
+ pContent->DoXFConvert(pCont);
+ }
+}
+
+LwpViewportLayout::LwpViewportLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpPlacableLayout(objHdr, pStrm)
+{
+}
+
+LwpViewportLayout::~LwpViewportLayout()
+{
+}
+
+/**
+ * @descr read note layout object
+ *
+ */
+void LwpViewportLayout::Read()
+{
+ LwpPlacableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpViewportLayout::RegisterStyle()
+{
+}
+
+void LwpViewportLayout::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpnotes.hxx b/lotuswordpro/source/filter/lwpnotes.hxx
new file mode 100644
index 000000000..df79d1b62
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpnotes.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - notes
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPNOTES_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPNOTES_HXX
+
+#include <lwpfrib.hxx>
+#include "lwpframelayout.hxx"
+
+/**
+ * @brief TAG_NOTE_FRIB object
+ *
+ */
+class LwpFribNote: public LwpFrib
+{
+public:
+ explicit LwpFribNote(LwpPara* pPara );
+ void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) override;
+ void RegisterNewStyle();
+ void XFConvert(XFContentContainer* pCont);
+private:
+ LwpObjectID m_Layout;
+};
+
+/**
+ * @brief VO_NOTELAYOUT object
+ *
+ */
+class LwpNoteLayout final : public LwpFrameLayout
+{
+public:
+ LwpNoteLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpNoteLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_NOTE_LAYOUT;}
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ sal_uInt32 GetTime() const { return m_nTime;}
+ OUString GetAuthor();
+
+private:
+ void Read() override;
+ LwpVirtualLayout* GetTextLayout();
+
+ sal_uInt32 m_nTime;
+ LwpAtomHolder m_UserName;
+};
+
+/**
+ * @brief VO_NOTEHEADERLAYOUT object
+ *
+ */
+class LwpNoteHeaderLayout: public LwpFrameLayout
+{
+public:
+ LwpNoteHeaderLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpNoteHeaderLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_NOTEHEADER_LAYOUT;}
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_NOTETEXTLAYOUT object
+ *
+ */
+class LwpNoteTextLayout: public LwpFrameLayout
+{
+public:
+ LwpNoteTextLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpNoteTextLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_NOTETEXT_LAYOUT;}
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief VO_VPLAYOUT object
+ *
+ */
+class LwpViewportLayout: public LwpPlacableLayout
+{
+public:
+ LwpViewportLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpViewportLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_VIEWPORT_LAYOUT;}
+ virtual void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+
+protected:
+ void Read() override;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpnumberingoverride.cxx b/lotuswordpro/source/filter/lwpnumberingoverride.cxx
new file mode 100644
index 000000000..a478f7112
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpnumberingoverride.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Numbering override of Wordpro.
+************************************************************************/
+
+#include "lwpnumberingoverride.hxx"
+#include <lwpobjstrm.hxx>
+
+LwpNumberingOverride::LwpNumberingOverride()
+ : m_nLevel(0)
+ , m_nPosition(0)
+{
+}
+
+LwpNumberingOverride::LwpNumberingOverride(LwpNumberingOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nLevel(rOther.m_nLevel)
+ , m_nPosition(rOther.m_nPosition)
+{
+}
+
+LwpNumberingOverride* LwpNumberingOverride::clone() const
+{
+ return new LwpNumberingOverride(*this);
+}
+
+void LwpNumberingOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+
+ m_nLevel = pStrm->QuickReaduInt16();
+ m_nPosition = pStrm->QuickReaduInt16();
+ }
+
+ pStrm->SkipExtra();
+}
+
+void LwpNumberingOverride::OverrideLevel(sal_uInt16 nNewLv)
+{
+ m_nLevel = nNewLv;
+ LwpOverride::Override(NO_LEVEL, STATE_ON);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpnumberingoverride.hxx b/lotuswordpro/source/filter/lwpnumberingoverride.hxx
new file mode 100644
index 000000000..b4851a103
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpnumberingoverride.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Numbering override of Wordpro.
+************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPNUMBERINGOVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPNUMBERINGOVERRIDE_HXX
+
+#include <lwpoverride.hxx>
+
+class LwpObjectStream;
+class LwpNumberingOverride final : public LwpOverride
+{
+public:
+ LwpNumberingOverride();
+
+ virtual LwpNumberingOverride* clone() const override;
+
+ enum
+ {
+ NO_LEVEL = 0x0001,
+ NO_POSITION = 0x0002,
+ HEADING = 0x0004,
+ SMARTLEVEL = 0x0008
+ };
+
+ virtual void Read(LwpObjectStream *pStrm) override;
+
+ inline sal_uInt16 GetLevel() const;
+ inline sal_uInt16 GetPosition() const;
+ inline bool IsHeading() const;
+
+ void OverrideLevel(sal_uInt16 nNewLv);
+
+private:
+ LwpNumberingOverride(LwpNumberingOverride const& rOther);
+ LwpNumberingOverride& operator=(LwpNumberingOverride const& rOther) = delete;
+
+ sal_uInt16 m_nLevel;
+ sal_uInt16 m_nPosition;
+};
+
+inline sal_uInt16 LwpNumberingOverride::GetLevel() const
+{
+ return m_nLevel;
+}
+
+inline sal_uInt16 LwpNumberingOverride::GetPosition() const
+{
+ return m_nPosition;
+}
+
+inline bool LwpNumberingOverride::IsHeading() const
+{
+ return (m_nValues & HEADING) != 0;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpnumericfmt.cxx b/lotuswordpro/source/filter/lwpnumericfmt.cxx
new file mode 100644
index 000000000..3edf96eeb
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpnumericfmt.cxx
@@ -0,0 +1,466 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table cell numerics format
+ */
+
+#include <memory>
+#include <lwpfilehdr.hxx>
+#include "lwpnumericfmt.hxx"
+
+LwpCurrencyPool LwpNumericFormat::m_aCurrencyInfo;
+
+OUString LwpCurrencyPool::GetCurrencySymbol(sal_uInt16 nFormat)
+{
+ return m_aCurrencyInfo[nFormat].sSymbol;
+}
+
+bool LwpCurrencyPool::IsSymbolPost(sal_uInt16 nFormat)
+{
+ return m_aCurrencyInfo[nFormat].bPost;
+}
+
+bool LwpCurrencyPool::IsShowSpace(sal_uInt16 nFormat)
+{
+ return m_aCurrencyInfo[nFormat].bShowSpace;
+}
+
+XFStyle* LwpLayoutNumerics::Convert()
+{
+ return cNumerics.Convert();
+}
+
+void LwpLayoutNumerics::Read()
+{
+ LwpVirtualPiece::Read();
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000b)
+ {
+ cNumerics.Read();
+ m_pObjStrm->SkipExtra();
+ }
+}
+
+void LwpNumericFormatSubset::QuickRead(LwpObjectStream* pStrm)
+{
+ cColor.Read(pStrm);
+ cPrefix.Read(pStrm);
+ cSuffix.Read(pStrm);
+ cSubFlags = pStrm->QuickReaduInt16();
+
+ pStrm->SkipExtra();
+}
+LwpColor LwpNumericFormatSubset::GetColor() const
+{
+ if (cSubFlags&0x04)
+ {
+ return cColor;
+ }
+ else
+ {
+ return LwpColor();
+ }
+}
+LwpNumericFormatSubset::LwpNumericFormatSubset():cSubFlags(0)
+{
+}
+
+LwpNumericFormat::LwpNumericFormat(LwpObjectStream * pStrm)
+ : m_pObjStrm(pStrm)
+ , cFlags(0)
+ , cFormat(FMT_DEFAULT)
+ , cDecimalPlaces(0)
+{
+ assert(pStrm);
+}
+/**
+* Read number format from wordpro file
+*/
+void LwpNumericFormat::Read()
+{
+ LwpObjectStream* pStrm = m_pObjStrm;
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000b)
+ {
+ cFlags = pStrm->QuickReaduInt16();
+ cDecimalPlaces = pStrm->QuickReaduInt16();
+ cFormat = pStrm->QuickReaduInt16();
+
+ cAnyNumber.QuickRead(pStrm);
+ cZero.QuickRead(pStrm);
+ cNegative.QuickRead(pStrm);
+
+ pStrm->SkipExtra();
+ }
+}
+bool LwpNumericFormat::IsCurrencyFormat(sal_uInt16 Format)
+{
+ switch (Format)
+ {
+ case FMT_ARGENTINEANPESO:
+ case FMT_AUSTRALIANDOLLAR:
+ case FMT_AUSTRIANSCHILLING:
+ case FMT_BELGIANFRANC:
+ case FMT_BRAZILIANCRUZEIRO:
+ case FMT_BRITISHPOUND:
+ case FMT_CANADIANDOLLAR:
+ case FMT_CHINESEYUAN:
+ case FMT_CZECHKORUNA:
+ case FMT_DANISHKRONE:
+ case FMT_ECU:
+ case FMT_FINNISHMARKKA:
+ case FMT_FRENCHFRANC:
+ case FMT_GREEKDRACHMA:
+ case FMT_HONGKONGDOLLAR:
+ case FMT_HUNGARIANFORINT:
+ case FMT_INDIANRUPEE:
+ case FMT_INDONESIANRUPIAH:
+ case FMT_IRISHPUNT:
+ case FMT_LUXEMBOURGFRANC:
+ case FMT_MALAYSIANRINGGIT:
+ case FMT_MEXICANPESO:
+ case FMT_NETHERLANDSGUILDER:
+ case FMT_NEWZEALANDDOLLAR:
+ case FMT_NORWEGIANKRONE:
+ case FMT_POLISHZLOTY:
+ case FMT_PORTUGUESEESCUDO:
+ case FMT_ROMANIANLEI:
+ case FMT_RUSSIANRUBLE:
+ case FMT_SINGAPOREDOLLAR:
+ case FMT_SLOVAKIANKORUNA:
+ case FMT_SLOVENIANTHOLAR:
+ case FMT_SOUTHAFRICANRAND:
+ case FMT_SOUTHKOREANWON:
+ case FMT_SWEDISHKRONA:
+ case FMT_SWISSFRANC:
+ case FMT_TAIWANDOLLAR:
+ case FMT_THAIBAHT:
+ case FMT_USDOLLAR:
+ case FMT_OTHERCURRENCY:
+ case FMT_GERMANMARK:
+ case FMT_ITALIANLIRA:
+ case FMT_JAPANESEYEN:
+ case FMT_SPANISHPESETA:
+ case FMT_EURO:
+ return true;
+
+ default:
+ return false;
+ }
+}
+sal_uInt16
+LwpNumericFormat::GetDecimalPlaces()
+{
+ if (IsDecimalPlacesOverridden())
+ return cDecimalPlaces;
+ return GetDefaultDecimalPlaces(cFormat);
+}
+void LwpNumericFormat::GetCurrencyStr(LwpNumericFormatSubset aNumber, OUString& aPrefix, OUString& aSuffix, bool bNegtive)
+{
+ aPrefix = aNumber.GetPrefix();
+ aSuffix = aNumber.GetSuffix();
+
+ //Make the default prefix and suffix
+ OUString aSymbol = m_aCurrencyInfo.GetCurrencySymbol(cFormat);
+ bool bPost = m_aCurrencyInfo.IsSymbolPost(cFormat);
+ bool bShowSpace = m_aCurrencyInfo.IsShowSpace(cFormat);
+ if ( aNumber.IsDefaultPrefix())
+ {
+ if (bNegtive)
+ {
+ aPrefix = "(";
+ }
+ if (!bPost)
+ {
+ aPrefix += aSymbol;
+ if (bShowSpace)
+ {
+ aPrefix += " ";
+ }
+ }
+ }
+ if ( !aNumber.IsDefaultSuffix())
+ return;
+
+ if (bPost)
+ {
+ aSuffix = aSymbol;
+ if (bShowSpace)
+ {
+ aSuffix = " " + aSuffix;
+ }
+
+ }
+
+ if (bNegtive)
+ {
+ aSuffix += ")";
+ }
+}
+void LwpNumericFormat::SetNumberType(XFNumberStyle* pStyle)
+{
+ switch(cFormat)
+ {
+ case FMT_PERCENT:
+ {
+ pStyle->SetNumberType(enumXFNumberPercent);
+ }
+ break;
+
+ case FMT_COMMA:
+ {
+ pStyle->SetNumberType(enumXFNumberNumber);
+ pStyle->SetGroup();
+ }
+ break;
+ case FMT_SCIENTIFIC:
+ {
+ pStyle->SetNumberType(enumXFNumberScientific);
+ }
+ break;
+ case FMT_FIXED:
+ case FMT_GENERAL:
+ {
+ pStyle->SetNumberType(enumXFNumberNumber);
+ }
+ break;
+ default://including text type, which is not a style of number format in SODC
+ {
+ pStyle->SetNumberType(enumXFText);
+ }
+ break;
+ }
+}
+/**
+* Make the xml content of number format
+*/
+XFStyle* LwpNumericFormat::Convert()
+{
+ XFNumberStyle* pStyle = new XFNumberStyle;
+ OUString aPrefix, aSuffix,aNegPrefix,aNegSuffix;
+ LwpColor aColor, aNegativeColor;
+
+ if (IsCurrencyFormat(cFormat))
+ {
+ pStyle->SetNumberType(enuMXFNumberCurrency);
+ pStyle->SetGroup();
+ GetCurrencyStr(cAnyNumber, aPrefix, aSuffix);
+ GetCurrencyStr(cNegative, aNegPrefix, aNegSuffix,true);
+ }
+ else
+ {
+ SetNumberType(pStyle);
+ {//Anynumber
+ aPrefix = cAnyNumber.GetPrefix();
+ //Set suffix
+ aSuffix = cAnyNumber.GetSuffix();
+ //Set color
+ aColor = cAnyNumber.GetColor();
+ }
+
+ if (!IsNegativeOverridden())
+ {
+ aNegPrefix = aPrefix;
+ aNegSuffix = aSuffix;
+ aNegativeColor = aColor;
+ }
+ else
+ {//negative
+ aNegPrefix = cNegative.GetPrefix();
+ aNegSuffix = cNegative.GetSuffix();
+ aNegativeColor = cNegative.GetColor();
+ }
+ if (FMT_COMMA==cFormat)
+ {
+ if (cNegative.IsDefaultPrefix() && aNegPrefix.isEmpty())
+ {
+ aNegPrefix = "(";
+ }
+ if (cNegative.IsDefaultSuffix() && aNegSuffix.isEmpty())
+ {
+ aNegSuffix = ")";
+ }
+ }
+
+ }
+
+ pStyle->SetDecimalDigits(GetDecimalPlaces());
+
+ aPrefix = reencode(aPrefix);
+ aSuffix = reencode(aSuffix);
+ aNegPrefix = reencode(aNegPrefix);
+ aNegSuffix = reencode(aNegSuffix);
+
+ {//Anynumber
+ //Set prefix
+ pStyle->SetPrefix(aPrefix);
+ //Set suffix
+ pStyle->SetSurfix(aSuffix);
+ pStyle->SetColor( XFColor( static_cast<sal_uInt8>(aColor.GetRed()),
+ static_cast<sal_uInt8>(aColor.GetGreen()),
+ static_cast<sal_uInt8>(aColor.GetBlue())) );
+ }
+ {//Negative
+ pStyle->SetNegativeStyle( aNegPrefix, aNegSuffix, XFColor(static_cast<sal_uInt8>(aNegativeColor.GetRed()),
+ static_cast<sal_uInt8>(aNegativeColor.GetGreen()),
+ static_cast<sal_uInt8>(aNegativeColor.GetBlue())) );
+ }
+
+ return pStyle;
+}
+/**
+*
+* @description for SODC_2754
+* @return fix wrong encoding of POUND symbol
+*/
+OUString LwpNumericFormat::reencode(const OUString& sCode)
+{
+ const sal_Unicode * pString = sCode.getStr();
+ sal_uInt16 nLen = sCode.getLength();
+ bool bFound = false;
+ sal_Int32 i;
+ std::unique_ptr<sal_Unicode[]> pBuff( new sal_Unicode[sCode.getLength()] );
+
+ for (i=0; i< sCode.getLength() - 1; i++)
+ {
+ if ( (pString[i] == 0x00a1) && (pString[i+1] == 0x00ea))
+ {
+ bFound = true;
+ break;
+ }
+ pBuff[i] = pString[i];
+ }
+ if (bFound)
+ {
+ pBuff[i] = 0xffe1;
+ for (sal_Int32 j=i+1; j < sCode.getLength() - 1; ++j)
+ {
+ pBuff[j] = pString[j+1];
+ }
+ OUString sRet(pBuff.get(), nLen - 1);
+ return sRet;
+ }
+
+ return sCode;
+}
+
+sal_uInt16
+LwpNumericFormat::GetDefaultDecimalPlaces(sal_uInt16 Format)
+{
+ switch (Format)
+ {
+ case FMT_ARGENTINEANPESO:
+ case FMT_AUSTRALIANDOLLAR:
+ case FMT_AUSTRIANSCHILLING:
+ case FMT_BELGIANFRANC:
+ case FMT_BRAZILIANCRUZEIRO:
+ case FMT_BRITISHPOUND:
+ case FMT_CANADIANDOLLAR:
+ case FMT_CHINESEYUAN:
+ case FMT_CZECHKORUNA:
+ case FMT_DANISHKRONE:
+ case FMT_ECU:
+ case FMT_FINNISHMARKKA:
+ case FMT_FRENCHFRANC:
+ case FMT_GERMANMARK:
+ case FMT_HONGKONGDOLLAR:
+ case FMT_HUNGARIANFORINT:
+ case FMT_INDIANRUPEE:
+ case FMT_INDONESIANRUPIAH:
+ case FMT_IRISHPUNT:
+ case FMT_LUXEMBOURGFRANC:
+ case FMT_MALAYSIANRINGGIT:
+ case FMT_MEXICANPESO:
+ case FMT_NETHERLANDSGUILDER:
+ case FMT_NEWZEALANDDOLLAR:
+ case FMT_NORWEGIANKRONE:
+ case FMT_POLISHZLOTY:
+ case FMT_PORTUGUESEESCUDO:
+ case FMT_ROMANIANLEI:
+ case FMT_RUSSIANRUBLE:
+ case FMT_SINGAPOREDOLLAR:
+ case FMT_SLOVAKIANKORUNA:
+ case FMT_SLOVENIANTHOLAR:
+ case FMT_SOUTHAFRICANRAND:
+ case FMT_SOUTHKOREANWON:
+ case FMT_SWEDISHKRONA:
+ case FMT_SWISSFRANC:
+ case FMT_TAIWANDOLLAR:
+ case FMT_THAIBAHT:
+ case FMT_USDOLLAR:
+ case FMT_OTHERCURRENCY:
+ case FMT_EURO:
+ return 2;
+
+ case FMT_GREEKDRACHMA:
+ case FMT_ITALIANLIRA:
+ case FMT_JAPANESEYEN:
+ case FMT_SPANISHPESETA:
+ return 0;
+
+ case FMT_DEFAULT:
+ case FMT_GENERAL:
+ case FMT_FIXED:
+ case FMT_COMMA:
+ case FMT_PERCENT:
+ case FMT_SCIENTIFIC:
+ default:
+ return 2;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpnumericfmt.hxx b/lotuswordpro/source/filter/lwpnumericfmt.hxx
new file mode 100644
index 000000000..225f373c4
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpnumericfmt.hxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table object
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPNUMERICFMT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPNUMERICFMT_HXX
+
+#include <map>
+
+#include <lwpatomholder.hxx>
+#include <lwpcolor.hxx>
+#include "lwppiece.hxx"
+
+//For converting to xml
+#include <xfilter/xfnumberstyle.hxx>
+
+class LwpObjectStream;
+
+class LwpNumericFormatSubset final
+{
+public:
+ LwpNumericFormatSubset();
+ void QuickRead(LwpObjectStream* pStrm);
+ OUString const & GetPrefix() const { return cPrefix.str();}
+ OUString const & GetSuffix() const { return cSuffix.str();}
+ bool IsDefaultPrefix() const { return !(cSubFlags&SF_OVER_PREFIX); }
+ bool IsDefaultSuffix() const { return !(cSubFlags&SF_OVER_SUFFIX); }
+ LwpColor GetColor() const;
+
+private:
+ LwpColor cColor;
+ LwpAtomHolder cPrefix;
+ LwpAtomHolder cSuffix;
+ sal_uInt16 cSubFlags;
+
+ enum // for cSubFlags
+ {
+ SF_OVER_PREFIX = 0x0001,
+ SF_OVER_SUFFIX = 0x0002,
+ SF_OVER_COLOR = 0x0004
+ };
+};
+
+struct LwpCurrencyInfo
+{
+ OUString sSymbol;
+ bool bPost;
+ bool bShowSpace;
+ explicit LwpCurrencyInfo(const OUString& sSym)
+ : sSymbol(sSym), bPost(false), bShowSpace(false)
+ {
+ }
+ LwpCurrencyInfo() : bPost(false), bShowSpace(false)
+ {
+ }
+ LwpCurrencyInfo(const OUString& sSym, bool bPost_, bool bShowSpace_)
+ : sSymbol(sSym), bPost(bPost_), bShowSpace(bShowSpace_)
+ {
+ }
+};
+
+enum
+{
+ /* These are types of formats. They are mutually exclusive.
+ */
+ FMT_NONE = 0,
+ FMT_ARGENTINEANPESO = 1,
+ FMT_AUSTRALIANDOLLAR = 2,
+ FMT_AUSTRIANSCHILLING = 3,
+ FMT_BELGIANFRANC = 4,
+ FMT_BRAZILIANCRUZEIRO = 5,
+ FMT_BRITISHPOUND = 6,
+ FMT_CANADIANDOLLAR = 7,
+ FMT_CHINESEYUAN = 8,
+ FMT_CZECHKORUNA = 9,
+ FMT_DANISHKRONE = 10,
+ FMT_ECU = 11,
+ FMT_FINNISHMARKKA = 12,
+ FMT_FRENCHFRANC = 13,
+ FMT_GERMANMARK = 14,
+ FMT_GREEKDRACHMA = 15,
+ FMT_HONGKONGDOLLAR = 16,
+ FMT_HUNGARIANFORINT = 17,
+ FMT_INDIANRUPEE = 18,
+ FMT_INDONESIANRUPIAH = 19,
+ FMT_IRISHPUNT = 20,
+ FMT_ITALIANLIRA = 21,
+ FMT_JAPANESEYEN = 22,
+ FMT_LUXEMBOURGFRANC = 23,
+ FMT_MALAYSIANRINGGIT = 24,
+ FMT_MEXICANPESO = 25,
+ FMT_NETHERLANDSGUILDER = 26,
+ FMT_NEWZEALANDDOLLAR = 27,
+ FMT_NORWEGIANKRONE = 28,
+ FMT_POLISHZLOTY = 29,
+ FMT_PORTUGUESEESCUDO = 30,
+ FMT_ROMANIANLEI = 31,
+ FMT_RUSSIANRUBLE = 32,
+ FMT_SINGAPOREDOLLAR = 33,
+ FMT_SLOVAKIANKORUNA = 34,
+ FMT_SLOVENIANTHOLAR = 35,
+ FMT_SOUTHAFRICANRAND = 36,
+ FMT_SOUTHKOREANWON = 37,
+ FMT_SPANISHPESETA = 38,
+ FMT_SWEDISHKRONA = 39,
+ FMT_SWISSFRANC = 40,
+ FMT_TAIWANDOLLAR = 41,
+ FMT_THAIBAHT = 42,
+ FMT_USDOLLAR = 43,
+ FMT_OTHERCURRENCY = 44,
+ FMT_DEFAULT = 45,
+ FMT_GENERAL = 46,
+ FMT_FIXED = 47,
+ FMT_COMMA = 48,
+ FMT_PERCENT = 49,
+ FMT_SCIENTIFIC = 50,
+ FMT_LABEL = 51,
+ FMT_EURO = 52
+};
+
+class LwpCurrencyPool
+{
+public:
+ LwpCurrencyPool(){InitCurrencySymbol();}
+ OUString GetCurrencySymbol(sal_uInt16 nFormat);
+ bool IsShowSpace(sal_uInt16 nFormat);
+ bool IsSymbolPost(sal_uInt16 nFormat);
+
+private:
+ std::map<sal_uInt16,LwpCurrencyInfo> m_aCurrencyInfo;
+ void InitCurrencySymbol()
+ {
+ sal_uInt16 nC=FMT_ARGENTINEANPESO;
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("A"); //FMT_ARGENTINEANPESO = 1,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("A$"); //FMT_AUSTRALIANDOLLAR = 2,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("oS",true, true);//FMT_AUSTRIANSCHILLING = 3,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("BF",true, true);//FMT_BELGIANFRANC = 4,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("R$",false, true);//FMT_BRAZILIANCRUZEIRO = 5,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo(OUString(u"\uFFE1")); //FMT_BRITISHPOUND = 6,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("C$"); //FMT_CANADIANDOLLAR = 7,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo(OUString(u"PRC\uFFE5"),false,true); //FMT_CHINESEYUAN = 8,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Kc",true, true);//FMT_CZECHKORUNA = 9,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Dkr",false, true);//FMT_DANISHKRONE = 10,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("ECU",true, true);//FMT_ECU = 11,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("mk",true, true);//FMT_FINNISHMARKKA = 12,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("F",true, true);//FMT_FRENCHFRANC = 13,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("DM",true, true);//FMT_GERMANMARK = 14,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Dr",true, true);//FMT_GREEKDRACHMA = 15,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("HK$"); //FMT_HONGKONGDOLLAR = 16,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Ft",true, true);//FMT_HUNGARIANFORINT = 17,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Rs",false, true);//FMT_INDIANRUPEE = 18,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Rp",false, true);//FMT_INDONESIANRUPIAH = 19,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo(OUString(u"IR\uFFE1")); //FMT_IRISHPUNT = 20,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("L.",false, true);//FMT_ITALIANLIRA = 21,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo(OUString(u"\uFFE5")); //FMT_JAPANESEYEN = 22,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("LF",true, true);//FMT_LUXEMBOURGFRANC = 23,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Rm",false, true);//FMT_MALAYSIANRINGGIT = 24,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Mex$"); //FMT_MEXICANPESO = 25,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("F",false, true);//FMT_NETHERLANDSGUILDER = 26,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("NZ$"); //FMT_NEWZEALANDDOLLAR = 27,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Nkr",false, true);//FMT_NORWEGIANKRONE = 28,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Zl",true, true);//FMT_POLISHZLOTY = 29,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Esc.",true, true);//FMT_PORTUGUESEESCUDO = 30,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Leu",true, true);//FMT_ROMANIANLEI = 31,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("R",true, true);//FMT_RUSSIANRUBLE = 32,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("S$"); //FMT_SINGAPOREDOLLAR = 33,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Sk",true, true);//FMT_SLOVAKIANKORUNA = 34,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("SIT",false, true);//FMT_SLOVENIANTHOLAR = 35,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("R"); //FMT_SOUTHAFRICANRAND = 36,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("W"); //FMT_SOUTHKOREANWON = 37,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Pts",true, true);//FMT_SPANISHPESETA = 38,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Skr",true, true);//FMT_SWEDISHKRONA = 39,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("SFr",false, true);//FMT_SWISSFRANC = 40,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("NT$"); //FMT_TAIWANDOLLAR = 41,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("Bt",true, true);//FMT_THAIBAHT = 42,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("$"); //FMT_USDOLLAR = 43,
+ m_aCurrencyInfo[nC++]=LwpCurrencyInfo("OTH",false, true);//FMT_OTHERCURRENCY = 44,
+
+ m_aCurrencyInfo[FMT_EURO]=LwpCurrencyInfo(OUString(u"\u20AC")); //FMT_EURO = 52
+ }
+};
+
+class LwpNumericFormat
+{
+public:
+ explicit LwpNumericFormat(LwpObjectStream * pStrm);
+ void Read();
+ static bool IsCurrencyFormat(sal_uInt16 Format);
+ sal_uInt16 GetDecimalPlaces();
+ bool IsDecimalPlacesOverridden() const;
+ bool IsNegativeOverridden() const;
+ XFStyle* Convert();
+
+private:
+ LwpObjectStream * m_pObjStrm;
+
+ sal_uInt16 cFlags;
+ enum // for cFlags
+ {
+ NF_OVER_ZERO = 0x0001,
+ NF_OVER_NEGATIVE = 0x0002,
+ NF_OVER_DECIMAL_PLACES = 0x0004
+ };
+
+ sal_uInt16 cFormat;
+
+ LwpNumericFormatSubset cAnyNumber;
+ LwpNumericFormatSubset cZero;
+ LwpNumericFormatSubset cNegative;
+
+ sal_uInt16 cDecimalPlaces;
+
+ static sal_uInt16 GetDefaultDecimalPlaces(sal_uInt16 Format);
+ static LwpCurrencyPool m_aCurrencyInfo;
+
+ void GetCurrencyStr(LwpNumericFormatSubset aNumber, OUString& aPrefix, OUString& aSuffix, bool bNegtive=false);
+ void SetNumberType(XFNumberStyle* pStyle);
+ static OUString reencode(const OUString& sCode);
+};
+
+inline bool
+LwpNumericFormat::IsDecimalPlacesOverridden() const
+{
+ return (cFlags & NF_OVER_DECIMAL_PLACES) != 0;
+}
+
+inline bool
+LwpNumericFormat::IsNegativeOverridden() const
+{
+ return (cFlags & NF_OVER_NEGATIVE) != 0;
+}
+
+class LwpLayoutNumerics final : public LwpVirtualPiece
+{
+public:
+ LwpLayoutNumerics(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ :LwpVirtualPiece(objHdr, pStrm),cNumerics(m_pObjStrm.get()){}
+ XFStyle* Convert();
+ virtual void Read() override;
+
+private:
+ virtual ~LwpLayoutNumerics() override {}
+
+ LwpNumericFormat cNumerics;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpobj.cxx b/lotuswordpro/source/filter/lwpobj.cxx
new file mode 100644
index 000000000..05de5684b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpobj.cxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <lwpobj.hxx>
+
+/**
+ * @descr construct lwpobject from stream
+ */
+LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm)
+ : m_ObjHdr(objHdr), m_pFoundry(nullptr)
+ , m_pStrm(pStrm), m_bRegisteringStyle(false), m_bParsingStyle(false)
+ , m_bConvertingContent(false)
+{
+ m_pObjStrm.reset( new LwpObjectStream(pStrm, m_ObjHdr.IsCompressed(),
+ static_cast<sal_uInt16>(m_ObjHdr.GetSize()) ) );
+}
+/**
+ * @descr dtor()
+*/
+LwpObject::~LwpObject()
+{
+}
+/**
+ * @descr QuickRead template
+ */
+void LwpObject::QuickRead()
+{
+ Read();
+ if(m_pObjStrm)
+ {
+ m_pObjStrm->ReadComplete();
+ m_pObjStrm.reset();
+ }
+}
+/**
+ * @descr default read function
+ */
+void LwpObject::Read()
+{}
+/**
+ * @descr default parse function
+ */
+void LwpObject::Parse(IXFStream* /*pOutputStream*/)
+{}
+/**
+ * @descr default register style function
+ */
+void LwpObject::RegisterStyle()
+{}
+
+/**
+ * @descr default XFConvert function
+ * pCont is the XFContentContainer for the object conversion
+ */
+void LwpObject::XFConvert(XFContentContainer* /*pCont*/)
+{}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpobjfactory.cxx b/lotuswordpro/source/filter/lwpobjfactory.cxx
new file mode 100644
index 000000000..2b0b056e4
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpobjfactory.cxx
@@ -0,0 +1,727 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpobjfactory.hxx>
+#include <lwpdefs.hxx>
+#include "lwpdoc.hxx"
+#include "lwpstory.hxx"
+#include "lwplayout.hxx"
+#include "lwppara.hxx"
+#include "lwpparastyle.hxx"
+#include "lwpcharacterstyle.hxx"
+#include "lwppiece.hxx"
+#include "lwptabrack.hxx"
+#include "lwpsilverbullet.hxx"
+#include "lwpdivinfo.hxx"
+#include "lwpholder.hxx"
+#include "lwpdivopts.hxx"
+#include "lwplaypiece.hxx"
+#include "lwpsection.hxx"
+#include "lwppagehint.hxx"
+#include "lwpoleobject.hxx"
+#include "lwpgrfobj.hxx"
+#include "lwptable.hxx"
+#include "lwptblcell.hxx"
+#include "lwpmarker.hxx"
+#include "lwpproplist.hxx"
+#include <new>
+#include "lwpframelayout.hxx"
+#include "lwptablelayout.hxx"
+#include "lwppagelayout.hxx"
+#include "lwptblformula.hxx"
+#include "lwpvpointer.hxx"
+#include "lwpfootnote.hxx"
+#include "lwpnumericfmt.hxx"
+#include "lwpfnlayout.hxx"
+#include "lwptoc.hxx"
+#include <lwpdocdata.hxx>
+#include "lwpnotes.hxx"
+#include "lwpverdocument.hxx"
+#include <sal/log.hxx>
+#include <osl/diagnose.h>
+
+//LwpObjectFactory* LwpObjectFactory::m_pMgr = NULL;
+
+LwpObjectFactory::LwpObjectFactory(LwpSvStream* pSvStream)
+ : m_pSvStream(pSvStream)
+{
+ m_IdToObjList.clear();
+}
+
+LwpObjectFactory::~LwpObjectFactory() {}
+
+/**
+ * @descr read the index manager
+*/
+void LwpObjectFactory::ReadIndex(LwpSvStream* pStrm) { m_IndexMgr.Read(pStrm); }
+
+/**
+ * @descr create all kinds of objects except lwp7
+*/
+rtl::Reference<LwpObject> LwpObjectFactory::CreateObject(sal_uInt32 type, LwpObjectHeader& objHdr)
+{
+ rtl::Reference<LwpObject> newObj;
+ SAL_WARN_IF(type >= 300, "lwp", "invalid type: " << type);
+ switch (type)
+ {
+ case VO_DOCUMENT:
+ {
+ newObj = new LwpDocument(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_DOCSOCK:
+ {
+ newObj = new LwpDocSock(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_DIVISIONINFO:
+ {
+ newObj = new LwpDivInfo(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_DIVOPTS:
+ {
+ newObj = new LwpDivisionOptions(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_HEADCONTENT:
+ {
+ newObj = new LwpHeadContent(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_HEADLAYOUT:
+ {
+ newObj = new LwpHeadLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PAGELAYOUT:
+ {
+ newObj = new LwpPageLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_STORY:
+ {
+ newObj = new LwpStory(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PARA:
+ {
+ newObj = new LwpPara(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_HEADERLAYOUT:
+ {
+ newObj = new LwpHeaderLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FOOTERLAYOUT:
+ {
+ newObj = new LwpFooterLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FRAMELAYOUT:
+ {
+ newObj = new LwpFrameLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTGEOMETRY:
+ {
+ newObj = new LwpLayoutGeometry(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTSCALE:
+ {
+ newObj = new LwpLayoutScale(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTMARGINS:
+ {
+ newObj = new LwpLayoutMargins(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTBORDERSTUFF:
+ {
+ newObj = new LwpLayoutBorder(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTBACKGROUNDSTUFF:
+ {
+ newObj = new LwpLayoutBackground(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTEXTERNALBORDERSTUFF:
+ {
+ newObj = new LwpLayoutExternalBorder(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTCOLUMNS:
+ {
+ newObj = new LwpLayoutColumns(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTGUTTERSTUFF:
+ {
+ newObj = new LwpLayoutGutters(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTJOINSTUFF:
+ {
+ newObj = new LwpLayoutJoins(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTSHADOW:
+ {
+ newObj = new LwpLayoutShadow(objHdr, m_pSvStream);
+ break;
+ }
+ // 01/12/2005
+ case VO_PARASTYLE:
+ {
+ newObj = new LwpParaStyle(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CHARACTERSTYLE:
+ {
+ newObj = new LwpCharacterStyle(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_SILVERBULLET:
+ {
+ newObj = new LwpSilverBullet(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_ALIGNMENTPIECE:
+ {
+ newObj = new LwpAlignmentPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_INDENTPIECE:
+ {
+ newObj = new LwpIndentPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_SPACINGPIECE:
+ {
+ newObj = new LwpSpacingPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CHARBORDERPIECE:
+ {
+ newObj = new LwpCharacterBorderPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_AMIKAKEPIECE:
+ {
+ newObj = new LwpAmikakePiece(objHdr, m_pSvStream);
+ break;
+ }
+
+ case VO_HEADHOLDER:
+ {
+ newObj = new LwpDLVListHeadHolder(objHdr, m_pSvStream);
+ break;
+ }
+
+ // start
+ case VO_PARABORDERPIECE:
+ {
+ newObj = new LwpParaBorderPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_BREAKSPIECE:
+ {
+ newObj = new LwpBreaksPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_NUMBERINGPIECE:
+ {
+ newObj = new LwpNumberingPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TABRACK:
+ {
+ newObj = new LwpTabRack(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TABPIECE:
+ {
+ newObj = new LwpTabPiece(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PARABACKGROUNDPIECE: //perhaps wrong.
+ {
+ newObj = new LwpBackgroundPiece(objHdr, m_pSvStream);
+ break;
+ }
+
+ case VO_SECTION:
+ {
+ newObj = new LwpSection(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_INDEXSECTION:
+ {
+ newObj = new LwpIndexSection(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_HEADTAILHOLDER:
+ {
+ newObj = new LwpDLVListHeadTailHolder(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PAGEHINT:
+ {
+ newObj = new LwpPageHint(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_OLEOBJECT:
+ {
+ newObj = new LwpOleObject(objHdr, m_pSvStream);
+ break;
+ }
+
+ case VO_GRAPHIC:
+ {
+ newObj = new LwpGraphicObject(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_DOCDATA:
+ {
+ newObj = new LwpDocData(objHdr, m_pSvStream);
+ break;
+ }
+
+ case VO_DROPCAPLAYOUT:
+ {
+ newObj = new LwpDropcapLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTRELATIVITY:
+ {
+ newObj = new LwpLayoutRelativity(objHdr, m_pSvStream);
+ break;
+ }
+ // for table
+ case VO_TABLE:
+ {
+ newObj = new LwpTable(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TABLELAYOUT:
+ {
+ newObj = new LwpTableLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_SUPERTABLE:
+ {
+ newObj = new LwpSuperTable(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_SUPERTABLELAYOUT:
+ {
+ newObj = new LwpSuperTableLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CELLLAYOUT:
+ {
+ newObj = new LwpCellLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_ROWLAYOUT:
+ {
+ newObj = new LwpRowLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LAYOUTNUMERICS:
+ {
+ newObj = new LwpLayoutNumerics(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_NUMERICVALUE:
+ {
+ newObj = new LwpNumericValue(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FORMULAINFO:
+ {
+ newObj = new LwpFormulaInfo(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_COLUMNLAYOUT:
+ {
+ newObj = new LwpColumnLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_ROWLIST:
+ {
+ newObj = new LwpRowList(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CELLLIST:
+ {
+ newObj = new LwpCellList(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TABLERANGE:
+ {
+ newObj = new LwpTableRange(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CELLRANGE:
+ {
+ newObj = new LwpCellRange(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FOLDER:
+ {
+ newObj = new LwpFolder(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_DEPENDENT:
+ {
+ newObj = new LwpDependent(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CONNECTEDCELLLAYOUT:
+ {
+ newObj = new LwpConnectedCellLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_HIDDENCELLLAYOUT:
+ {
+ newObj = new LwpHiddenCellLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TABLEHEADINGLAYOUT:
+ {
+ newObj = new LwpTableHeadingLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_ROWHEADINGLAYOUT:
+ {
+ newObj = new LwpRowHeadingLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TABLEHEADING:
+ {
+ newObj = new LwpTableHeading(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CHBLKMARKER:
+ {
+ newObj = new LwpCHBlkMarker(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PROPLIST:
+ {
+ newObj = new LwpPropListElement(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_BOOKMARK:
+ {
+ newObj = new LwpBookMark(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FIELDMARKER:
+ {
+ newObj = new LwpFieldMark(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_OBJECTHOLDER:
+ {
+ newObj = new LwpObjectHolder(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_POBJECTHOLDER:
+ {
+ newObj = new LwpObjectHolder(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_VERGTR: //fall through
+ case VO_VERQTR:
+ {
+ newObj = new LwpVersionedPointer(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FOOTNOTE:
+ {
+ newObj = new LwpFootnote(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FOOTNOTETABLE:
+ {
+ newObj = new LwpFootnoteTable(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FOOTNOTEOPTS:
+ {
+ newObj = new LwpFootnoteOptions(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FOOTNOTELAYOUT:
+ {
+ newObj = new LwpFootnoteLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FNROWLAYOUT:
+ {
+ newObj = new LwpFnRowLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FNCELLLAYOUT:
+ {
+ newObj = new LwpFnCellLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_ENDNOTELAYOUT:
+ {
+ newObj = new LwpEndnoteLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_ENSUPERTABLELAYOUT:
+ {
+ newObj = new LwpEnSuperTableLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_FNSUPERTABLELAYOUT:
+ {
+ newObj = new LwpFnSuperTableLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CONTONLAYOUT:
+ {
+ newObj = new LwpContOnLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_CONTFROMLAYOUT:
+ {
+ newObj = new LwpContFromLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_GROUPLAYOUT:
+ {
+ newObj = new LwpGroupLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_GROUPFRAME:
+ {
+ newObj = new LwpGroupFrame(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TOCSUPERTABLELAYOUT:
+ {
+ newObj = new LwpTocSuperLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_LISTLIST:
+ {
+ newObj = new LwpListList(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_TOCLEVELDATA:
+ {
+ newObj = new LwpTocLevelData(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_NOTELAYOUT:
+ {
+ newObj = new LwpNoteLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_NOTEHEADERLAYOUT:
+ {
+ newObj = new LwpNoteHeaderLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_NOTETEXTLAYOUT:
+ {
+ newObj = new LwpNoteTextLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_VPLAYOUT:
+ {
+ newObj = new LwpViewportLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PCOLBLOCK:
+ {
+ newObj = new LwpParallelColumnsBlock(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_SUPERPARALLELCOLUMNLAYOUT:
+ {
+ newObj = new LwpSuperParallelColumnLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PCOLLAYOUT:
+ {
+ newObj = new LwpParallelColumnsLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_PARALLELCOLUMNS:
+ {
+ newObj = new LwpParallelColumns(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_RUBYMARKER:
+ {
+ newObj = new LwpRubyMarker(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_RUBYLAYOUT:
+ {
+ newObj = new LwpRubyLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_GLOSSARY:
+ {
+ newObj = new LwpGlossary(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_SUPERGLOSSARYLAYOUT:
+ {
+ newObj = new LwpSuperGlossaryLayout(objHdr, m_pSvStream);
+ break;
+ }
+ case VO_VERDOCUMENT:
+ {
+ newObj = new LwpVerDocument(objHdr, m_pSvStream);
+ break;
+ }
+ default:
+ {
+ //Unknown object type
+ newObj = nullptr;
+ break;
+ }
+ }
+ if (newObj.is())
+ {
+ newObj->QuickRead();
+ auto result = m_IdToObjList.emplace(objHdr.GetID(), newObj);
+ if (!result.second)
+ {
+ SAL_WARN("lwp", "clearing duplicate object");
+ newObj.clear();
+ }
+ }
+
+ return newObj;
+}
+/**
+ * @descr query object by object id
+ * object is created if not in the factory
+*/
+rtl::Reference<LwpObject> LwpObjectFactory::QueryObject(const LwpObjectID& objID)
+{
+ rtl::Reference<LwpObject> obj = FindObject(objID);
+ if (!obj.is())
+ {
+ //Read the object from file
+ sal_uInt32 nStreamOffset = m_IndexMgr.GetObjOffset(objID);
+ if (nStreamOffset == BAD_OFFSET) //does not find the offset in index manager
+ return nullptr;
+
+ sal_Int64 nDesiredPos = nStreamOffset + LwpSvStream::LWP_STREAM_BASE;
+ if (nDesiredPos != m_pSvStream->Seek(nDesiredPos))
+ return nullptr;
+ LwpObjectHeader objHdr;
+ if (!objHdr.Read(*m_pSvStream))
+ return nullptr;
+
+ LwpObjectID& rId = objHdr.GetID();
+ if (rId != objID)
+ {
+ OSL_FAIL("apparently incorrect objid, invalidating");
+ return nullptr;
+ }
+
+ if (std::find(m_aObjsIDInCreation.begin(), m_aObjsIDInCreation.end(), objID)
+ != m_aObjsIDInCreation.end())
+ throw std::runtime_error("recursion in object creation");
+
+ m_aObjsIDInCreation.push_back(objID);
+ obj = CreateObject(objHdr.GetTag(), objHdr);
+ m_aObjsIDInCreation.pop_back();
+ }
+ return obj;
+}
+
+/**
+ * @descr find object in the factory per the object id
+*/
+rtl::Reference<LwpObject> LwpObjectFactory::FindObject(const LwpObjectID& objID)
+{
+ LwpIdToObjMap::const_iterator it = m_IdToObjList.find(objID);
+ if (it != m_IdToObjList.end())
+ {
+ return (*it).second;
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+/**
+ * @descr release object in the factory per the object id
+*/
+void LwpObjectFactory::ReleaseObject(const LwpObjectID& objID) { m_IdToObjList.erase(objID); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpobjhdr.cxx b/lotuswordpro/source/filter/lwpobjhdr.cxx
new file mode 100644
index 000000000..d93cf001f
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpobjhdr.cxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpobjhdr.hxx>
+#include <lwpobjtags.hxx>
+#include <lwpdefs.hxx>
+#include <lwpfilehdr.hxx>
+
+LwpObjectHeader::LwpObjectHeader()
+ : m_nTag(0), m_ID(), m_nSize(0), m_bCompressed(false)
+{}
+/**
+ * @descr read header from stream
+ */
+bool LwpObjectHeader::Read(LwpSvStream &rStrm)
+{
+ sal_uInt32 nVersionID = 0;
+ sal_uInt32 nRefCount = 0;
+ sal_uInt32 nNextVersionOffset = 0;
+ sal_uInt32 nHeaderSize = 0;
+
+ sal_Int64 nStartPos = rStrm.Tell();
+
+ if ( LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ rStrm.ReadUInt32( m_nTag );
+ m_ID.Read(&rStrm);
+ rStrm.ReadUInt32( nVersionID );
+ rStrm.ReadUInt32( nRefCount );
+ rStrm.ReadUInt32( nNextVersionOffset );
+
+ nHeaderSize = sizeof(m_nTag) + LwpObjectID::DiskSize()
+ + sizeof(nVersionID)
+ + sizeof(nRefCount)
+ + sizeof(nNextVersionOffset)
+ + sizeof(m_nSize);
+
+ if ((m_nTag == TAG_AMI) || ( LwpFileHeader::m_nFileRevision < 0x0006))
+ {
+ sal_uInt32 nNextVersionID = 0;
+ rStrm.ReadUInt32( nNextVersionID );
+ nHeaderSize += sizeof(nNextVersionID);
+ }
+ rStrm.ReadUInt32( m_nSize );
+ }
+ else
+ {
+ sal_uInt8 nFlagBits = 0;
+ sal_uInt16 VOType = 0;
+ rStrm.ReadUInt16( VOType );
+ rStrm.ReadUInt8( nFlagBits );
+
+ m_nTag = static_cast<sal_uInt32>(VOType);
+ m_ID.ReadIndexed(&rStrm);
+ nHeaderSize = sizeof(VOType) + sizeof(nFlagBits) + m_ID.DiskSizeIndexed();
+
+ sal_uInt8 tmpByte;
+ sal_uInt16 tmpShort;
+ switch (nFlagBits & VERSION_BITS)
+ {
+ case ONE_BYTE_VERSION:
+ rStrm.ReadUInt8( tmpByte );
+ nVersionID = static_cast<sal_uInt32>( tmpByte );
+ nHeaderSize++;
+ break;
+
+ case TWO_BYTE_VERSION:
+ rStrm.ReadUInt16( tmpShort );
+ nVersionID = static_cast<sal_uInt32>( tmpShort );
+ nHeaderSize += 2;
+ break;
+
+ case FOUR_BYTE_VERSION:
+ rStrm.ReadUInt32( nVersionID );
+ nHeaderSize += 4;
+ break;
+ case DEFAULT_VERSION: //fall through
+ default:
+ nVersionID = 2;
+ break; // nothing
+ }
+
+ switch (nFlagBits & REFCOUNT_BITS)
+ {
+ case ONE_BYTE_REFCOUNT:
+ rStrm.ReadUInt8( tmpByte );
+ nRefCount = static_cast<sal_uInt32>( tmpByte );
+ nHeaderSize++;
+ break;
+
+ case TWO_BYTE_REFCOUNT:
+ rStrm.ReadUInt16( tmpShort );
+ nRefCount = static_cast<sal_uInt32>( tmpShort );
+ nHeaderSize += 2;
+ break;
+
+ case FOUR_BYTE_REFCOUNT: //through
+ default:
+ rStrm.ReadUInt32( nRefCount );
+ nHeaderSize += 4;
+ break;
+ }
+
+ if (nFlagBits & HAS_PREVOFFSET)
+ {
+ rStrm.ReadUInt32( nNextVersionOffset );
+ nHeaderSize += 4;
+ }
+ else
+ nNextVersionOffset = BAD_OFFSET;
+
+ switch (nFlagBits & SIZE_BITS)
+ {
+ case ONE_BYTE_SIZE:
+ rStrm.ReadUInt8( tmpByte );
+ m_nSize = static_cast<sal_uInt32>( tmpByte );
+ nHeaderSize++;
+ break;
+
+ case TWO_BYTE_SIZE:
+ rStrm.ReadUInt16( tmpShort );
+ m_nSize = static_cast<sal_uInt32>(tmpShort);
+ nHeaderSize += 2;
+ break;
+
+ case FOUR_BYTE_SIZE: //go through
+ default:
+ rStrm.ReadUInt32( m_nSize );
+ nHeaderSize += 4;
+ break;
+ }
+
+ if (nFlagBits & DATA_COMPRESSED)
+ {
+ m_bCompressed = true;
+ }
+ }
+ sal_Int64 nEndPos = rStrm.Tell();
+ return (nStartPos + nHeaderSize == nEndPos);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpobjid.cxx b/lotuswordpro/source/filter/lwpobjid.cxx
new file mode 100644
index 000000000..767c60931
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpobjid.cxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpobjid.hxx>
+#include <lwpfilehdr.hxx>
+#include <lwpobjfactory.hxx>
+#include <lwpglobalmgr.hxx>
+
+LwpObjectID::LwpObjectID()
+ :m_nLow(0), m_nHigh(0), m_nIndex(0), m_bIsCompressed(false)
+{
+}
+/**
+ * @descr Read object id with format: low(4bytes)+high(2bytes) from stream
+ * for LWP7 record
+*/
+void LwpObjectID::Read(LwpSvStream *pStrm)
+{
+ pStrm->ReadUInt32( m_nLow );
+ pStrm->ReadUInt16( m_nHigh );
+}
+/**
+ * @descr Read object id with format: low(4bytes)+high(2bytes) from object stream
+*/
+sal_uInt32 LwpObjectID::Read(LwpObjectStream *pObj)
+{
+ m_nLow = pObj->QuickReaduInt32();
+ m_nHigh = pObj->QuickReaduInt16();
+ return DiskSize();
+}
+/**
+ * @descr Read object id with indexed format from stream
+ * if index>0, lowid is get from time table per the index
+* else index+lowid+highid
+*/
+void LwpObjectID::ReadIndexed(LwpSvStream *pStrm)
+{
+//note the m_nLow store the index instead of time from the timetable as in LWP
+ m_bIsCompressed = false;
+ if( LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ Read(pStrm);
+ return;
+ }
+
+ pStrm->ReadUInt8( m_nIndex );
+
+ if (m_nIndex)
+ {
+ m_bIsCompressed = true;
+ //m_nLow = index; //note the m_nLow stores the index instead of the actual time id
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpObjectFactory* pFactory = pGlobal->GetLwpObjFactory();
+ LwpIndexManager& rIdxMgr = pFactory->GetIndexManager();
+ m_nLow = rIdxMgr.GetObjTime( static_cast<sal_uInt16>(m_nIndex));
+ }
+ else
+ {
+ pStrm->ReadUInt32( m_nLow );
+ }
+ pStrm->ReadUInt16( m_nHigh );
+ DiskSizeIndexed();
+}
+
+/**
+ * @descr Read object id with indexed format from object stream
+ * if index>0, lowid is get from time table per the index
+* else index+lowid+highid
+*/
+sal_uInt32 LwpObjectID::ReadIndexed(LwpObjectStream *pStrm)
+{
+ m_bIsCompressed = false;
+ if(LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ return Read(pStrm);
+ }
+
+ m_nIndex = pStrm->QuickReaduInt8();
+ if (m_nIndex)
+ {
+ m_bIsCompressed = true;
+ //m_nLow = index; //note the m_nLow stores the index instead of the actual time id
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpObjectFactory* pFactory = pGlobal->GetLwpObjFactory();
+ LwpIndexManager& rIdxMgr = pFactory->GetIndexManager();
+ m_nLow = rIdxMgr.GetObjTime( static_cast<sal_uInt16>(m_nIndex));
+ }
+ else
+ m_nLow = pStrm->QuickReaduInt32();
+ m_nHigh = pStrm->QuickReaduInt16();
+ return DiskSizeIndexed();
+}
+/**
+ * @descr Read object id with compressed format from object stream
+ * if diff == 255: 255+lowid+highid
+ * else lowid equals to the lowid of previous low id
+ * and high id = the high id of previous id + diff +1
+*/
+void LwpObjectID::ReadCompressed( LwpObjectStream* pObj, LwpObjectID const &prev )
+{
+ sal_uInt8 diff = pObj->QuickReaduInt8();
+
+ if (diff == 255)
+ {
+ Read(pObj);
+ }
+ else
+ {
+ m_nLow = prev.GetLow();
+ m_nHigh = prev.GetHigh() + diff +1;
+ }
+}
+/**
+ * @descr return the size of indexed object id
+*/
+sal_uInt32 LwpObjectID::DiskSizeIndexed() const
+{
+ return sizeof(sal_uInt8)
+ + ((m_nIndex != 0) ? 0 : sizeof(m_nLow))
+ + sizeof(m_nHigh);
+}
+/**
+ * @descr get object from object factory per the object id
+*/
+rtl::Reference<LwpObject> LwpObjectID::obj(VO_TYPE tag) const
+{
+ if (IsNull())
+ {
+ return nullptr;
+ }
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
+ rtl::Reference<LwpObject> pObj = pObjMgr->QueryObject(*this);
+ if( tag!=VO_INVALID && (pObj.is()) )
+ {
+ if(static_cast<sal_uInt32>(tag) != pObj->GetTag())
+ {
+ pObj.clear();
+ }
+ }
+ return pObj;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx
new file mode 100644
index 000000000..5cd37f191
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpobjstrm.cxx
@@ -0,0 +1,380 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <lwpobjstrm.hxx>
+#include <lwptools.hxx>
+
+#include <sal/types.h>
+#include <tools/solar.h>
+#include <memory>
+
+/**
+ * @descr ctor() from LwpSvStream
+ */
+LwpObjectStream::LwpObjectStream(LwpSvStream *pStrm, bool isCompressed, sal_uInt16 size)
+ :m_pContentBuf(nullptr), m_nBufSize(size), m_nReadPos(0),
+ m_pStrm(pStrm), m_bCompressed(isCompressed)
+{
+ if (size >= IO_BUFFERSIZE)
+ throw std::range_error("bad Object size");
+ // read object data from stream
+ if (m_nBufSize > 0)
+ Read2Buffer();
+}
+
+/**
+ * @descr read object data from stream to buffer
+ */
+void LwpObjectStream::Read2Buffer()
+{
+ ReleaseBuffer();
+
+ m_nReadPos = 0;
+
+ if( m_bCompressed )
+ {
+ std::unique_ptr<sal_uInt8[]> xCompressBuf(new sal_uInt8[m_nBufSize]);
+
+ sal_uInt8* pCompressBuffer = xCompressBuf.get();
+ memset(pCompressBuffer, 0, m_nBufSize);
+ m_nBufSize = m_pStrm->Read(pCompressBuffer, m_nBufSize);
+
+ sal_uInt8 pTempDst[IO_BUFFERSIZE];
+ m_nBufSize = DecompressBuffer(pTempDst, pCompressBuffer, m_nBufSize);
+ assert( m_nBufSize < IO_BUFFERSIZE);
+
+ m_pContentBuf = AllocBuffer(m_nBufSize);
+ memcpy(m_pContentBuf, pTempDst, m_nBufSize);
+ }
+ else
+ {
+ m_pContentBuf = AllocBuffer(m_nBufSize);
+ m_nBufSize = m_pStrm->Read(m_pContentBuf, m_nBufSize);
+ }
+}
+/**
+ * @descr alloc size of buffer
+ */
+sal_uInt8* LwpObjectStream::AllocBuffer(sal_uInt16 size)
+{
+ if (size<=100)
+ {
+ return m_SmallBuffer;
+ }
+ m_BigBuffer.resize(size);
+ return m_BigBuffer.data();
+}
+/**
+ * @descr signal complete to release object buffer
+ */
+void LwpObjectStream::ReadComplete()
+{
+ ReleaseBuffer();
+}
+
+LwpObjectStream::~LwpObjectStream()
+{
+ ReleaseBuffer();
+}
+/**
+ * @descr release object buffer
+ */
+void LwpObjectStream::ReleaseBuffer()
+{
+ m_BigBuffer.clear();
+ m_pContentBuf = nullptr;
+}
+
+sal_uInt16 LwpObjectStream::remainingSize() const
+{
+ return m_nBufSize - m_nReadPos;
+}
+
+/**
+ * @descr read len bytes from object stream to buffer
+ */
+sal_uInt16 LwpObjectStream::QuickRead(void* buf, sal_uInt16 len)
+{
+ memset(buf, 0, len);
+ if( len > m_nBufSize - m_nReadPos )
+ {
+ len = m_nBufSize - m_nReadPos;
+ }
+ if( m_pContentBuf && len)
+ {
+ memcpy(buf, m_pContentBuf+m_nReadPos, len);
+ m_nReadPos += len;
+ }
+ return len;
+}
+/**
+ * @descr SeekRel pos in object stream/buffer
+ */
+void LwpObjectStream::SeekRel(sal_uInt16 pos)
+{
+ if( pos > m_nBufSize - m_nReadPos)
+ pos = m_nBufSize - m_nReadPos;
+ m_nReadPos +=pos;
+}
+/**
+ * @descr Seek to pos in object buffer/buffer
+ */
+void LwpObjectStream::Seek( sal_uInt16 pos)
+{
+ if (pos < m_nBufSize)
+ {
+ m_nReadPos = pos;
+ }
+}
+
+/**
+ * @descr Quick read sal_Bool
+ */
+bool LwpObjectStream::QuickReadBool()
+{
+ SVBT16 aValue = {0};
+ QuickRead(aValue, sizeof(aValue));
+ return static_cast<bool>(SVBT16ToUInt16(aValue));
+}
+/**
+ * @descr Quick read sal_uInt32
+ */
+sal_uInt32 LwpObjectStream::QuickReaduInt32(bool *pFailure)
+{
+ SVBT32 aValue = {0};
+ sal_uInt16 nRead = QuickRead(aValue, sizeof(aValue));
+ if (pFailure)
+ *pFailure = (nRead != sizeof(aValue));
+ return SVBT32ToUInt32(aValue);
+}
+/**
+ * @descr Quick read sal_uInt32
+ */
+sal_uInt16 LwpObjectStream::QuickReaduInt16(bool *pFailure)
+{
+ SVBT16 aValue = {0};
+ sal_uInt16 nRead = QuickRead(aValue, sizeof(aValue));
+ if (pFailure)
+ *pFailure = (nRead != sizeof(aValue));
+ return SVBT16ToUInt16(aValue);
+}
+/**
+ * @descr Quick read sal_Int32
+ */
+sal_Int32 LwpObjectStream::QuickReadInt32()
+{
+ SVBT32 aValue = {0};
+ QuickRead(aValue, sizeof(aValue));
+ return static_cast<sal_Int32>(SVBT32ToUInt32(aValue));
+}
+/**
+ * @descr Quick read sal_Int16
+ */
+sal_Int16 LwpObjectStream::QuickReadInt16()
+{
+ SVBT16 aValue = {0};
+ QuickRead(aValue, sizeof(aValue));
+
+ return static_cast<sal_Int16>(SVBT16ToUInt16(aValue));
+}
+/**
+ * @descr Quick read sal_uInt8
+ */
+sal_uInt8 LwpObjectStream::QuickReaduInt8(bool *pFailure)
+{
+ sal_uInt8 aValue = 0;
+ sal_uInt16 nRead = QuickRead(&aValue, sizeof(aValue));
+ if (pFailure)
+ *pFailure = (nRead != sizeof(aValue));
+ return aValue;
+}
+/**
+ * @descr Quick read double
+ */
+double LwpObjectStream::QuickReadDouble()
+{
+ union
+ {
+ double d;
+ sal_uInt8 c[8];
+ } s;
+ memset(s.c, 0, sizeof(s.c));
+ QuickRead(s.c, sizeof(s.c));
+#if defined(OSL_BIGENDIAN)
+ for (size_t i = 0; i < 4; ++i)
+ std::swap(s.c[i], s.c[7-i]);
+#endif
+ return s.d;
+}
+/**
+ * @descr skip extra bytes
+ */
+void LwpObjectStream::SkipExtra()
+{
+ sal_uInt16 extra = QuickReaduInt16();
+ while (extra != 0)
+ extra = QuickReaduInt16();
+}
+/**
+ * @descr check if extra bytes
+ */
+sal_uInt16 LwpObjectStream::CheckExtra()
+{
+ return QuickReaduInt16();
+}
+/**
+ * @descr decompress data buffer from pSrc to pDst
+ * Refer to the CAmiPro40File::DecompressObject(~) in LWP
+ */
+sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, sal_uInt16 Size)
+{
+ sal_uInt16 Cnt;
+ sal_uInt32 DstSize = 0;
+
+ while (Size)
+ {
+ switch (*pSrc & 0xC0)
+ {
+ case 0x00:
+ // 1 - 64 bytes of 0
+ // Code 00zzzzzz
+ // where zzzzzz is the count - 1 of compressed 0 bytes
+
+ Cnt = (*pSrc++ & 0x3F) + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
+ memset(pDst, 0, Cnt);
+ pDst += Cnt;
+ DstSize += Cnt;
+ Size--;
+ break;
+
+ case 0x40:
+ // 1 - 8 zeros followed by 1 - 8 non-zero
+ // Code 01zzznnn binary
+ // where zzz is the count - 1 of compressed zero bytes
+ // and nnn is the count - 1 of following non-zero bytes
+
+ Cnt = ((*pSrc & 0x38) >> 3) + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
+ memset(pDst, 0, Cnt);
+ pDst += Cnt;
+ DstSize += Cnt;
+ Cnt = (*pSrc++ & 0x07) + 1;
+ if (Size < Cnt + 1)
+ throw BadDecompress();
+ Size -= Cnt + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
+ memcpy(pDst, pSrc, Cnt);
+ pDst += Cnt;
+ DstSize += Cnt;
+ pSrc += Cnt;
+ break;
+
+ case 0x80:
+ // 1 0 followed by 1 - 64 bytes of non-zero
+ // Code 0x80 (or 0x40 if 8 or less non-zero)
+ // Code 10nnnnnn binary
+ // where nnnnnn is the count - 1 of following non-zero bytes
+
+ *pDst++ = 0;
+ DstSize++;
+ [[fallthrough]];
+
+ case 0xC0:
+ // 1 - 64 bytes of non-zero
+ // Code = 11nnnnnn binary
+ // nnnnnn is the count less 1 of following non-zero bytes
+
+ Cnt = (*pSrc++ & 0x3F) + 1;
+ if (Size < Cnt + 1)
+ throw BadDecompress();
+ Size -= Cnt + 1;
+ if (DstSize+Cnt >= IO_BUFFERSIZE)
+ throw BadDecompress();
+ memcpy(pDst, pSrc, Cnt);
+ pDst += Cnt;
+ DstSize += Cnt;
+ pSrc += Cnt;
+ break;
+ }
+ assert(DstSize < IO_BUFFERSIZE);
+ if (DstSize >= IO_BUFFERSIZE)
+ throw BadDecompress();
+
+ }
+ return static_cast<sal_uInt16>(DstSize);
+}
+/**
+ * @descr quick read string with 1252
+ */
+OUString LwpObjectStream::QuickReadStringPtr()
+{
+ sal_uInt16 diskSize;
+
+ diskSize = QuickReaduInt16();
+ QuickReaduInt16(); //len
+
+ OUString str;
+ if (diskSize < sizeof diskSize)
+ throw std::range_error("Too small size");
+ LwpTools::QuickReadUnicode(this, str, diskSize-sizeof(diskSize), RTL_TEXTENCODING_MS_1252);
+ return str;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpoleobject.cxx b/lotuswordpro/source/filter/lwpoleobject.cxx
new file mode 100644
index 000000000..ed500545f
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpoleobject.cxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - OLE object
+ */
+
+#include <tools/stream.hxx>
+#include <lwpglobalmgr.hxx>
+#include "lwpoleobject.hxx"
+#include <lwpobjfactory.hxx>
+#include <lwpidxmgr.hxx>
+#include "lwp9reader.hxx"
+#include <xfilter/xfparagraph.hxx>
+#include "lwpframelayout.hxx"
+#include <o3tl/numeric.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include "bento.hxx"
+
+/**
+ * @descr: construction function
+ * @param: objHdr - object header, read before entering this function
+ * @param: pStrm - file stream
+ */
+LwpGraphicOleObject::LwpGraphicOleObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpContent(objHdr, pStrm)
+{}
+/**
+ * @descr: Read GraphicOleObject part
+ */
+void LwpGraphicOleObject::Read()
+{
+ LwpContent::Read();
+
+ if (LwpFileHeader::m_nFileRevision >= 0x000b)
+ {
+ // I'm not sure about the read method
+ m_pNextObj.ReadIndexed(m_pObjStrm.get());
+ m_pPrevObj.ReadIndexed(m_pObjStrm.get());
+ }
+ m_pObjStrm->SkipExtra();
+
+}
+
+void LwpGraphicOleObject::GetGrafOrgSize(double & rWidth, double & rHeight)
+{
+ rWidth = 0;
+ rHeight = 0;
+}
+
+void LwpGraphicOleObject::GetGrafScaledSize(double & fWidth, double & fHeight)
+{
+ GetGrafOrgSize(fWidth, fHeight);
+ // scaled image size
+ double fSclGrafWidth = fWidth;//LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth());
+ double fSclGrafHeight = fHeight;//LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight());
+
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ if (xLayout.is() && xLayout->IsFrame())
+ {
+ LwpFrameLayout* pMyFrameLayout = static_cast<LwpFrameLayout*>(xLayout.get());
+ LwpLayoutScale* pMyScale = pMyFrameLayout->GetLayoutScale();
+ LwpLayoutGeometry* pFrameGeo = pMyFrameLayout->GetGeometry();
+
+ // original image size
+ //double fOrgGrafWidth = (double)m_Cache.Width/TWIPS_PER_CM;
+ //double fOrgGrafHeight = (double)m_Cache.Height/TWIPS_PER_CM;
+
+ // get margin values
+ double fLeftMargin = pMyFrameLayout->GetMarginsValue(MARGIN_LEFT);
+ double fRightMargin = pMyFrameLayout->GetMarginsValue(MARGIN_RIGHT);
+ double fTopMargin = pMyFrameLayout->GetMarginsValue(MARGIN_TOP);
+ double fBottomMargin = pMyFrameLayout->GetMarginsValue(MARGIN_BOTTOM);
+
+ if (pMyScale && pFrameGeo)
+ {
+ // frame size
+ double fFrameWidth = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetWidth());
+ double fFrameHeight = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetHeight());
+
+ // calculate the displayed size of the frame
+ double fDisFrameWidth = fFrameWidth - (fLeftMargin+fRightMargin);
+ double fDisFrameHeight = fFrameHeight - (fTopMargin+fBottomMargin);
+
+ // get scale mode
+ sal_uInt16 nScalemode = pMyScale->GetScaleMode();
+ if (nScalemode & LwpLayoutScale::CUSTOM)
+ {
+ fSclGrafWidth = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth());
+ fSclGrafHeight = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight());
+ }
+ else if (nScalemode & LwpLayoutScale::PERCENTAGE)
+ {
+ double fScalePercentage = static_cast<double>(pMyScale->GetScalePercentage()) / 1000;
+ fSclGrafWidth = fScalePercentage * fWidth;
+ fSclGrafHeight = fScalePercentage * fHeight;
+ }
+ else if (nScalemode & LwpLayoutScale::FIT_IN_FRAME)
+ {
+ if (pMyFrameLayout->IsFitGraphic())
+ {
+ fSclGrafWidth = fWidth;
+ fSclGrafHeight = fHeight;
+ }
+ else if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO)
+ {
+ if (fHeight == 0.0 || fDisFrameHeight == 0.0)
+ throw o3tl::divide_by_zero();
+ if (fWidth/fHeight >= fDisFrameWidth/fDisFrameHeight)
+ {
+ fSclGrafWidth = fDisFrameWidth;
+ if (fWidth == 0.0)
+ throw o3tl::divide_by_zero();
+ fSclGrafHeight = (fDisFrameWidth/fWidth) * fHeight;
+ }
+ else
+ {
+ fSclGrafHeight = fDisFrameHeight;
+ fSclGrafWidth = (fDisFrameHeight/fHeight) * fWidth;
+ }
+ }
+ else
+ {
+ fSclGrafWidth = fDisFrameWidth;
+ fSclGrafHeight = fDisFrameHeight;
+ }
+ }
+ }
+ }
+ fWidth = fSclGrafWidth ;
+ fHeight = fSclGrafHeight ;
+}
+
+/**
+ * @descr: construction function
+ * @param: objHdr - object header, read before entering this function
+ * @param: pStrm - file stream
+ */
+LwpOleObject::LwpOleObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpGraphicOleObject(objHdr, pStrm)
+ , cPersistentFlags(0)
+ , m_SizeRect(0,0,5,5)
+{
+}
+/**
+ * @descr: Read VO_OLEOBJECT record
+ */
+void LwpOleObject::Read()
+{
+ LwpGraphicOleObject::Read();
+
+ cPersistentFlags = m_pObjStrm->QuickReaduInt16();
+
+ // qCMarker read
+ LwpObjectID ID;
+
+ if (LwpFileHeader::m_nFileRevision >= 0x0004)
+ {
+ m_pObjStrm->QuickReaduInt16();
+
+ m_pObjStrm->QuickReadStringPtr();
+
+ if (LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ // null pointers have a VO_INVALID type
+ //if (VO_INVALID == m_pObjStrm->QuickReaduInt16())
+ // return;
+
+ ID.Read(m_pObjStrm.get());
+ //return m_pObjStrm->Locate(ID);
+ }
+ else
+ {
+ ID.ReadIndexed(m_pObjStrm.get());
+ //if (ID.IsNull())
+ // return;
+
+ //return m_pObjStrm->Locate(ID);
+ }
+ }
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+ }
+
+}
+
+/**
+ * @descr: Parse VO_OLEOBJECT and dump to XML stream only on WIN32 platform
+ * @param: pOutputStream - stream to dump OLE object
+ * @param: pFrameLayout - framelayout object used to dump OLE object
+ */
+void LwpOleObject::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+void LwpOleObject::XFConvert(XFContentContainer * /*pCont*/)
+{
+}
+
+void LwpOleObject::GetGrafOrgSize(double & rWidth, double & rHeight)
+{
+ rWidth = static_cast<double>(m_SizeRect.GetWidth())/1000;//cm unit
+ rHeight = static_cast<double>(m_SizeRect.GetHeight())/1000;//cm unit
+}
+
+void LwpOleObject::RegisterStyle()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpoleobject.hxx b/lotuswordpro/source/filter/lwpoleobject.hxx
new file mode 100644
index 000000000..177bf3ef1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpoleobject.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - OLE object
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPOLEOBJECT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPOLEOBJECT_HXX
+
+#include "lwpcontent.hxx"
+#include <lwpobjhdr.hxx>
+#include <lwpobjid.hxx>
+#include <tools/gen.hxx>
+
+typedef struct tagAFID_CACHE
+{
+ unsigned long LinkedFileSize; /* 0 if not linked */
+ unsigned long LinkedFileTime; /* 0 if not linked */
+ long Width; /* -1 if not present */
+ long Height; /* -1 if not present */
+ tagAFID_CACHE()
+ : LinkedFileSize(0)
+ , LinkedFileTime(0)
+ , Width(0)
+ , Height(0)
+ {
+ }
+} AFID_CACHE, * PAFID_CACHE;
+
+/* Maximum string sizes - includes space for null terminator */
+#define AFID_MAX_FILE_FORMAT_SIZE 80
+#define AFID_MAX_CONTEXT_FORMAT_SIZE 80
+
+/**
+ * @descr
+ * super class of LwpOleObject and LwpGraphicObject
+ */
+class LwpGraphicOleObject : public LwpContent
+{
+public:
+ LwpGraphicOleObject(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Read() override;
+ void GetGrafScaledSize(double& fWidth, double& fHeight);
+ virtual void GetGrafOrgSize(double& rWidth, double& rHeight);
+protected:
+ LwpObjectID m_pPrevObj;
+ LwpObjectID m_pNextObj;
+
+ OUString m_strStyleName;
+};
+
+/**
+ * @descr
+ * class to read and parse VO_OLEOBJECT object
+ */
+class LwpOleObject : public LwpGraphicOleObject
+{
+public:
+ LwpOleObject(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+ virtual void Read() override;
+ virtual void Parse(IXFStream* pOutputStream) override;
+ virtual void XFConvert(XFContentContainer * pCont) override;
+ virtual void RegisterStyle() override;
+ void GetGrafOrgSize(double& rWidth, double& rHeight) override ;
+private:
+ sal_uInt16 cPersistentFlags;
+
+ tools::Rectangle m_SizeRect;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpoverride.cxx b/lotuswordpro/source/filter/lwpoverride.cxx
new file mode 100644
index 000000000..677b3638f
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpoverride.cxx
@@ -0,0 +1,608 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+
+#include "clone.hxx"
+#include <lwpoverride.hxx>
+#include <lwpfilehdr.hxx>
+#include <lwpatomholder.hxx>
+#include "lwpborderstuff.hxx"
+#include "lwpmargins.hxx"
+#include "lwpbackgroundstuff.hxx"
+
+/*class LwpOverride*/
+LwpOverride::LwpOverride(LwpOverride const& rOther)
+ : m_nValues(rOther.m_nValues)
+ , m_nOverride(rOther.m_nOverride)
+ , m_nApply(rOther.m_nApply)
+{
+}
+
+void LwpOverride::ReadCommon(LwpObjectStream* pStrm)
+{
+ m_nValues = pStrm->QuickReaduInt16();
+ m_nOverride = pStrm->QuickReaduInt16();
+ m_nApply = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+
+void LwpOverride::Clear()
+{
+ m_nValues = 0;
+ m_nOverride = 0;
+ m_nApply = 0;
+}
+
+void LwpOverride::Override(sal_uInt16 nBits, STATE eState)
+{
+ if (eState == STATE_STYLE)
+ {
+ m_nValues &= ~nBits;
+ m_nOverride &= ~nBits;
+ }
+ else
+ {
+ m_nOverride |= nBits;
+ if (eState == STATE_ON)
+ {
+ m_nValues |= nBits;
+ }
+ else /* State == STATE_OFF */
+ {
+ m_nValues &= ~nBits;
+ }
+ }
+ m_nApply |= nBits;
+}
+
+/*class LwpTextLanguageOverride*/
+LwpTextLanguageOverride::LwpTextLanguageOverride(LwpTextLanguageOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nLanguage(rOther.m_nLanguage)
+{
+}
+
+LwpTextLanguageOverride* LwpTextLanguageOverride::clone() const
+{
+ return new LwpTextLanguageOverride(*this);
+}
+
+void LwpTextLanguageOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_nLanguage = pStrm->QuickReaduInt16();
+ }
+
+ pStrm->SkipExtra();
+
+}
+
+/*class LwpTextAttributeOverride*/
+LwpTextAttributeOverride::LwpTextAttributeOverride(LwpTextAttributeOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nHideLevels(rOther.m_nHideLevels)
+ , m_nBaseLineOffset(rOther.m_nBaseLineOffset)
+{
+}
+
+LwpTextAttributeOverride* LwpTextAttributeOverride::clone() const
+{
+ return new LwpTextAttributeOverride(*this);
+}
+
+void LwpTextAttributeOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_nHideLevels = pStrm->QuickReaduInt16();
+
+ if (LwpFileHeader::m_nFileRevision > 0x000A)
+ m_nBaseLineOffset = pStrm->QuickReaduInt32();
+ }
+
+ pStrm->SkipExtra();
+}
+
+bool LwpTextAttributeOverride::IsHighlight() const
+{
+ return (m_nValues & TAO_HIGHLIGHT) != 0;
+}
+
+/*class LwpKinsokuOptsOverride*/
+LwpKinsokuOptsOverride::LwpKinsokuOptsOverride(LwpKinsokuOptsOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nLevels(rOther.m_nLevels)
+{
+}
+
+LwpKinsokuOptsOverride* LwpKinsokuOptsOverride::clone() const
+{
+ return new LwpKinsokuOptsOverride(*this);
+}
+
+void LwpKinsokuOptsOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_nLevels = pStrm->QuickReaduInt16();
+ }
+
+ pStrm->SkipExtra();
+}
+
+/*class LwpBulletOverride*/
+LwpBulletOverride::LwpBulletOverride(LwpBulletOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_SilverBullet(rOther.m_SilverBullet)
+ , m_bIsNull(rOther.m_bIsNull)
+{
+}
+
+LwpBulletOverride* LwpBulletOverride::clone() const
+{
+ return new LwpBulletOverride(*this);
+}
+
+void LwpBulletOverride::Read(LwpObjectStream * pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ m_bIsNull= false;
+ ReadCommon(pStrm);
+ m_SilverBullet.ReadIndexed(pStrm);
+ }
+ else
+ m_bIsNull = true;
+
+ pStrm->SkipExtra();
+}
+void LwpBulletOverride::OverrideSkip(bool bOver)
+{
+ if (bOver)
+ {
+ LwpOverride::Override(BO_SKIP, STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_SKIP, STATE_OFF);
+ }
+}
+
+void LwpBulletOverride::OverrideRightAligned(bool bOver)
+{
+ if(bOver)
+ {
+ LwpOverride::Override(BO_RIGHTALIGN,STATE_ON);
+ }
+ else
+ {
+ LwpOverride::Override(BO_RIGHTALIGN,STATE_OFF);
+ }
+}
+
+void LwpBulletOverride::OverrideSilverBullet(LwpObjectID aID)
+{
+ if (!aID.IsNull())
+ {
+ m_SilverBullet = aID;
+ }
+
+ LwpOverride::Override(BO_SILVERBULLET,STATE_ON);
+}
+
+void LwpBulletOverride::Override(LwpBulletOverride* pOther)
+{
+ if (m_nApply & BO_SILVERBULLET)
+ {
+ if (IsSilverBulletOverridden())
+ {
+ pOther->OverrideSilverBullet(m_SilverBullet);
+ }
+ else
+ {
+ pOther->RevertSilverBullet();
+ }
+ }
+
+ if (m_nApply & BO_SKIP)
+ {
+ if (IsSkipOverridden())
+ {
+ pOther->OverrideSkip(IsSkip());
+ }
+ else
+ {
+ pOther->RevertSkip();
+ }
+ }
+
+ if (m_nApply & BO_RIGHTALIGN)
+ {
+ if (IsRightAlignedOverridden())
+ {
+ pOther->OverrideRightAligned(IsRightAligned());
+ }
+ else
+ {
+ pOther->RevertRightAligned();
+ }
+ }
+
+}
+
+/*class LwpAlignmentOverride*/
+LwpAlignmentOverride::LwpAlignmentOverride(LwpAlignmentOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nAlignType(rOther.m_nAlignType)
+ , m_nPosition(rOther.m_nPosition)
+ , m_nAlignChar(rOther.m_nAlignChar)
+{
+}
+
+LwpAlignmentOverride* LwpAlignmentOverride::clone() const
+{
+ return new LwpAlignmentOverride(*this);
+}
+
+void LwpAlignmentOverride::Read(LwpObjectStream * pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_nAlignType = static_cast<AlignType>(pStrm->QuickReaduInt8());
+ m_nPosition = pStrm->QuickReaduInt32();
+ m_nAlignChar = pStrm->QuickReaduInt16();
+ }
+
+ pStrm->SkipExtra();
+}
+
+/*class LwpSpacingCommonOverride*/
+LwpSpacingCommonOverride::LwpSpacingCommonOverride(LwpSpacingCommonOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nSpacingType(rOther.m_nSpacingType)
+ , m_nAmount(rOther.m_nAmount)
+ , m_nMultiple(rOther.m_nMultiple)
+{
+}
+
+LwpSpacingCommonOverride* LwpSpacingCommonOverride::clone() const
+{
+ return new LwpSpacingCommonOverride(*this);
+}
+
+void LwpSpacingCommonOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ const sal_uInt16 nSpacingType = pStrm->QuickReaduInt16();
+ //only the bottom pair of bits matter
+ m_nSpacingType = static_cast<SpacingType>(nSpacingType & 0x3);
+ m_nAmount = pStrm->QuickReadInt32();
+ m_nMultiple = pStrm->QuickReadInt32();
+ }
+
+ pStrm->SkipExtra();
+}
+
+/*class LwpSpacingOverride*/
+LwpSpacingOverride::LwpSpacingOverride() :
+m_pSpacing(new LwpSpacingCommonOverride),
+m_pAboveLineSpacing(new LwpSpacingCommonOverride),
+m_pParaSpacingAbove(new LwpSpacingCommonOverride),
+m_pParaSpacingBelow(new LwpSpacingCommonOverride)
+{
+}
+
+LwpSpacingOverride::~LwpSpacingOverride()
+{
+}
+
+LwpSpacingOverride::LwpSpacingOverride(LwpSpacingOverride const& rOther)
+ : LwpOverride(rOther)
+{
+ m_pSpacing.reset( ::clone(rOther.m_pSpacing.get()) );
+ m_pAboveLineSpacing.reset( ::clone(rOther.m_pAboveLineSpacing.get()) );
+ m_pParaSpacingAbove.reset( ::clone(rOther.m_pParaSpacingAbove.get()) );
+ m_pParaSpacingBelow.reset( ::clone(rOther.m_pParaSpacingBelow.get()) );
+}
+
+LwpSpacingOverride* LwpSpacingOverride::clone() const
+{
+ return new LwpSpacingOverride(*this);
+}
+
+void LwpSpacingOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_pSpacing->Read(pStrm);
+ if (LwpFileHeader::m_nFileRevision >= 0x000d)
+ {
+ m_pAboveLineSpacing->Read(pStrm);
+ }
+ m_pParaSpacingAbove->Read(pStrm);
+ m_pParaSpacingBelow->Read(pStrm);
+ }
+
+ pStrm->SkipExtra();
+}
+
+/*class LwpIndentOverride*/
+LwpIndentOverride::LwpIndentOverride(LwpIndentOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nAll(rOther.m_nAll)
+ , m_nFirst(rOther.m_nFirst)
+ , m_nRest(rOther.m_nRest)
+ , m_nRight(rOther.m_nRight)
+{
+}
+
+LwpIndentOverride* LwpIndentOverride::clone() const
+{
+ return new LwpIndentOverride(*this);
+}
+
+void LwpIndentOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+
+ m_nAll = pStrm->QuickReadInt32();
+ m_nFirst = pStrm->QuickReadInt32();
+ m_nRest = pStrm->QuickReadInt32();
+ m_nRight = pStrm->QuickReadInt32();
+ }
+
+ pStrm->SkipExtra();
+}
+
+/*class LwpAmikakeOverride*/
+LwpAmikakeOverride::LwpAmikakeOverride() :
+m_pBackgroundStuff(new LwpBackgroundStuff), m_nType(AMIKAKE_NONE)
+{
+}
+
+LwpAmikakeOverride::~LwpAmikakeOverride()
+{
+}
+
+LwpAmikakeOverride::LwpAmikakeOverride(LwpAmikakeOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pBackgroundStuff(::clone(rOther.m_pBackgroundStuff.get()))
+ , m_nType(rOther.m_nType)
+{
+}
+
+LwpAmikakeOverride* LwpAmikakeOverride::clone() const
+{
+ return new LwpAmikakeOverride(*this);
+}
+
+void LwpAmikakeOverride::Read(LwpObjectStream* pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_pBackgroundStuff->Read(pStrm);
+ }
+ else
+ {
+ Clear();
+ }
+
+ if (pStrm->CheckExtra())
+ {
+ m_nType = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+ }
+ else
+ {
+ m_nType = AMIKAKE_NONE;
+ }
+}
+
+void LwpAlignmentOverride::Override(LwpAlignmentOverride* other)
+{
+ if (m_nOverride & AO_TYPE)
+ {
+ other->OverrideAlignment(m_nAlignType);
+ }
+}
+
+void LwpAlignmentOverride::OverrideAlignment(AlignType val)
+{
+ m_nAlignType = val;
+ m_nOverride |= AO_TYPE;
+}
+
+void LwpIndentOverride::Override(LwpIndentOverride* other)
+{
+ if(m_nOverride & IO_ALL)
+ other->OverrideIndentAll(m_nAll);
+ if(m_nOverride & IO_FIRST)
+ other->OverrideIndentFirst(m_nFirst);
+ if(m_nOverride & IO_RIGHT)
+ other->OverrideIndentRight(m_nRight);
+ if(m_nOverride & IO_REST)
+ other->OverrideIndentRest(m_nRest);
+ if(m_nOverride & IO_USE_RELATIVE)
+ other->OverrideUseRelative(IsUseRelative());
+ if (m_nOverride & IO_REL_FLAGS)
+ other->OverrideRelative(GetRelative());
+}
+
+sal_uInt16 LwpIndentOverride::GetRelative() const
+{
+ if ((m_nOverride & IO_REL_FLAGS) == IO_REL_FIRST)
+ return RELATIVE_FIRST;
+ else if ((m_nOverride & IO_REL_FLAGS) == IO_REL_ALL)
+ return RELATIVE_ALL;
+ return RELATIVE_REST;
+}
+
+bool LwpIndentOverride::IsUseRelative() const
+{
+ return (m_nValues & IO_USE_RELATIVE) != 0;
+}
+
+void LwpIndentOverride::OverrideIndentAll(sal_Int32 val)
+{
+ m_nAll = val;
+ m_nOverride |= IO_ALL;
+}
+
+void LwpIndentOverride::OverrideIndentFirst(sal_Int32 val)
+{
+ m_nFirst = val;
+ m_nOverride |= IO_FIRST;
+}
+
+void LwpIndentOverride::OverrideIndentRight(sal_Int32 val)
+{
+ m_nRight = val;
+ m_nOverride |= IO_RIGHT;
+}
+
+void LwpIndentOverride::OverrideIndentRest(sal_Int32 val)
+{
+ m_nRest = val;
+// m_nAll = val;
+// m_nFirst = 0-val;
+ m_nOverride |= IO_REST;
+}
+
+void LwpIndentOverride::OverrideUseRelative(bool use)
+{
+ if (use)
+ {
+ m_nOverride |= IO_USE_RELATIVE;
+ m_nValues |= IO_USE_RELATIVE;
+ }
+ else
+ {
+ m_nOverride &= ~IO_USE_RELATIVE;
+ m_nValues &= ~IO_USE_RELATIVE;
+ }
+}
+
+void LwpIndentOverride::OverrideRelative(sal_uInt16 relative)
+{
+ sal_uInt16 Flag;
+
+ if (relative == RELATIVE_FIRST)
+ Flag = IO_REL_FIRST;
+ else if (relative == RELATIVE_ALL)
+ Flag = IO_REL_ALL;
+ else
+ Flag = IO_REL_REST;
+
+ m_nOverride &= ~IO_REL_FLAGS;
+ m_nOverride |= Flag;
+}
+
+void LwpSpacingOverride::Override(LwpSpacingOverride* other)
+{
+ if (other)
+ {
+ m_pSpacing->Override(other->GetSpacing());
+ m_pAboveLineSpacing->Override(other->GetAboveLineSpacing());
+ m_pParaSpacingAbove->Override(other->GetAboveSpacing());
+ m_pParaSpacingBelow->Override(other->GetBelowSpacing());
+ }
+}
+
+void LwpSpacingCommonOverride::Override(LwpSpacingCommonOverride* other)
+{
+ if (m_nOverride & SPO_TYPE)
+ other->OverrideType(m_nSpacingType);
+ if (m_nOverride & SPO_AMOUNT)
+ other->OverrideAmount(m_nAmount);
+ if (m_nOverride & SPO_MULTIPLE)
+ other->OverrideMultiple(m_nMultiple);
+}
+
+void LwpSpacingCommonOverride::OverrideType(SpacingType val)
+{
+ m_nSpacingType = val;
+ m_nOverride |= SPO_TYPE;
+}
+
+void LwpSpacingCommonOverride::OverrideAmount(sal_Int32 val)
+{
+ m_nAmount = val;
+ m_nOverride |= SPO_AMOUNT;
+}
+
+void LwpSpacingCommonOverride::OverrideMultiple(sal_Int32 val)
+{
+ m_nMultiple = val;
+ m_nOverride |= SPO_MULTIPLE;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppagehint.cxx b/lotuswordpro/source/filter/lwppagehint.cxx
new file mode 100644
index 000000000..21fbf3d99
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppagehint.cxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwppagehint.hxx"
+
+void LwpSLVListHead::Read(LwpObjectStream* pObjStrm)
+{
+ m_ListHead.ReadIndexed(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+
+void LwpContentHintHead::Read(LwpObjectStream* pObjStrm)
+{
+ m_ListHead.Read(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+
+void LwpFootnoteSeenHead::Read(LwpObjectStream* pObjStrm)
+{
+ m_ListHead.Read(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+
+LwpPageHint::LwpPageHint(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm)
+ , m_nLastFootnoteSeen(0)
+ , m_nLastFootnoteProcessed(0)
+ , m_nFlags(0)
+ , m_nPageNumber(0)
+ , m_nNumberStyle(0)
+ , m_nNumberFlags(0)
+ , m_nRenderedPageNumber(0)
+ , m_nCurrentSectionPage(0)
+ , m_nLayoutPageNumber(0)
+{
+}
+
+void LwpPageHint::Read()
+{
+ LwpDLVList::Read();
+
+ m_PageLayout.ReadIndexed(m_pObjStrm.get());
+ //m_ContentHints.ReadIndexed(m_pObjStrm);
+ m_ContentHints.Read(m_pObjStrm.get());
+ m_nLastFootnoteSeen = m_pObjStrm->QuickReaduInt16();
+ m_nLastFootnoteProcessed = m_pObjStrm->QuickReaduInt16();
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ m_nPageNumber = m_pObjStrm->QuickReaduInt16();
+ m_nNumberStyle = m_pObjStrm->QuickReaduInt16();
+ m_BeforeText.Read(m_pObjStrm.get());
+ m_AfterText.Read(m_pObjStrm.get());
+ m_nNumberFlags = m_pObjStrm->QuickReaduInt8();
+ m_nRenderedPageNumber = m_pObjStrm->QuickReaduInt16();
+ m_CurrentSection.ReadIndexed(m_pObjStrm.get());
+ m_nCurrentSectionPage = m_pObjStrm->QuickReaduInt16();
+ //m_FootnoteSeen.ReadIndexed(m_pObjStrm);
+ m_FootnoteSeen.Read(m_pObjStrm.get());
+ m_nLayoutPageNumber = m_pObjStrm->QuickReaduInt16();
+
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpPageHint::Parse(IXFStream* /*pOutputStream*/) {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppagehint.hxx b/lotuswordpro/source/filter/lwppagehint.hxx
new file mode 100644
index 000000000..b6119f858
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppagehint.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPAGEHINT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPAGEHINT_HXX
+
+#include <lwpobjid.hxx>
+#include <lwpatomholder.hxx>
+#include "lwpdlvlist.hxx"
+
+class LwpSLVListHead
+{
+public:
+ LwpSLVListHead(){}
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpObjectID m_ListHead;
+};
+
+class LwpContentHintHead
+{
+public:
+ LwpContentHintHead(){}
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpSLVListHead m_ListHead;
+};
+
+class LwpFootnoteSeenHead
+{
+public:
+ LwpFootnoteSeenHead(){}
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpSLVListHead m_ListHead;
+};
+
+class LwpPageHint : public LwpDLVList
+{
+public:
+ LwpPageHint(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ void Parse(IXFStream* pOutputStream) override;
+ sal_uInt16 GetPageNumber() const {return m_nPageNumber;}
+ LwpObjectID& GetPageLayoutID(){ return m_PageLayout;}
+ sal_uInt16 GetLayoutPageNumber() const { return m_nLayoutPageNumber;}
+private:
+ virtual ~LwpPageHint() override {}
+
+ LwpObjectID m_PageLayout;
+ LwpContentHintHead m_ContentHints;
+ sal_uInt16 m_nLastFootnoteSeen;
+ sal_uInt16 m_nLastFootnoteProcessed;
+ sal_uInt16 m_nFlags;
+ sal_uInt16 m_nPageNumber;
+ sal_uInt16 m_nNumberStyle;
+ LwpAtomHolder m_BeforeText;
+ LwpAtomHolder m_AfterText;
+ sal_uInt8 m_nNumberFlags;
+ sal_uInt16 m_nRenderedPageNumber;
+ LwpObjectID m_CurrentSection;
+ sal_uInt16 m_nCurrentSectionPage;
+ LwpFootnoteSeenHead m_FootnoteSeen;
+ sal_uInt16 m_nLayoutPageNumber;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
new file mode 100644
index 000000000..d154be4ae
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -0,0 +1,1062 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <memory>
+#include "lwppagelayout.hxx"
+#include "lwplaypiece.hxx"
+#include "lwpfootnote.hxx"
+#include "lwpdoc.hxx"
+#include "lwpholder.hxx"
+#include "lwppagehint.hxx"
+#include "lwpdivinfo.hxx"
+#include "lwpstory.hxx"
+#include <o3tl/numeric.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfmasterpage.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <xfilter/xfheader.hxx>
+#include <xfilter/xfheaderstyle.hxx>
+#include <xfilter/xffooterstyle.hxx>
+#include <xfilter/xffooter.hxx>
+#include <sfx2/printer.hxx>
+#include <lwpchangemgr.hxx>
+#include <lwpfilehdr.hxx>
+#include <lwpglobalmgr.hxx>
+#include <sal/log.hxx>
+
+LwpPageLayout::LwpPageLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpLayout(objHdr, pStrm)
+ , m_nPrinterBin(0)
+ , m_nBdroffset(0)
+ , m_pXFPageMaster(nullptr)
+{
+}
+
+LwpPageLayout::~LwpPageLayout()
+{
+}
+void LwpPageLayout::Read()
+{
+ LwpLayout::Read();
+
+ if (LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ // read PreRevBLayout...
+ }
+
+ m_nPrinterBin = m_pObjStrm->QuickReaduInt16();
+ m_PrinterBinName.Read(m_pObjStrm.get());
+
+ if (LwpFileHeader::m_nFileRevision >= 0x000B)
+ m_nBdroffset = m_pObjStrm->QuickReadInt32();
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ m_PaperName.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+
+}
+
+void LwpPageLayout::Parse(IXFStream* pOutputStream)
+{
+ //Only parse this layout
+ rtl::Reference<LwpObject> pStory = m_Content.obj();
+ if(pStory.is())
+ {
+ pStory->SetFoundry(m_pFoundry);
+ pStory->DoParse(pOutputStream); //Do not parse the next story
+ }
+}
+
+/**
+* @descr: set page margins
+*
+*/
+void LwpPageLayout::ParseMargins(XFPageMaster* pm1)
+{
+ double fLeft = GetMarginsValue(MARGIN_LEFT);
+ double fRight = GetMarginsValue(MARGIN_RIGHT);
+ double fTop = GetMarginsValue(MARGIN_TOP);
+ double fBottom = GetMarginsValue(MARGIN_BOTTOM);
+
+ pm1->SetMargins( fLeft, fRight, fTop, fBottom );
+
+}
+
+/**
+* @descr: set page height and width
+*
+*/
+void LwpPageLayout::ParseGeometry(XFPageMaster* pm1)
+{
+ /*
+ LwpLayoutGeometry* pLayoutGeo = GetGeometry();
+ if(pLayoutGeo)
+ {
+ pm1->SetPageHeight( GetGeometryHeight() );
+ pm1->SetPageWidth( GetGeometryWidth() );
+ }
+ */
+ double fWidth =0;
+ double fHeight = 0;
+ GetWidthAndHeight(fWidth, fHeight);
+ pm1->SetPageWidth( fWidth );
+ pm1->SetPageHeight( fHeight );
+}
+
+/**
+* @descr: set page watermark
+*
+*/
+void LwpPageLayout::ParseWaterMark(XFPageMaster *pm1)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetXFBGImage());
+ if (xXFBGImage)
+ {
+ pm1->SetBackImage(xXFBGImage);
+ }
+}
+
+/**
+* @descr: set page columns
+*
+*/
+void LwpPageLayout::ParseColumns(XFPageMaster * pm1)
+{
+ XFColumns* pColumns = GetXFColumns();
+ if(pColumns)
+ {
+ pm1->SetColumns(pColumns);
+ }
+}
+
+/**
+* @descr: set page borders
+*
+*/
+void LwpPageLayout::ParseBorders(XFPageMaster *pm1)
+{
+ std::unique_ptr<XFBorders> pBordres = GetXFBorders();
+ if(pBordres)
+ {
+ pm1->SetBorders(std::move(pBordres));
+ }
+}
+
+/**
+* @descr: set page shadow
+*
+*/
+void LwpPageLayout::ParseShadow(XFPageMaster *pm1)
+{
+ XFShadow* pXFShadow = GetXFShadow();
+ if(pXFShadow)
+ {
+ pm1->SetShadow(pXFShadow);
+ }
+}
+
+/**
+* @descr: set page back pattern
+*
+*/
+void LwpPageLayout::ParsePatternFill(XFPageMaster* pm1)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetFillPattern());
+ if (xXFBGImage)
+ {
+ pm1->SetBackImage(xXFBGImage);
+ }
+}
+/**
+* @descr: set page background
+*
+*/
+void LwpPageLayout::ParseBackGround(XFPageMaster* pm1)
+{
+ if (IsPatternFill())
+ {
+ ParsePatternFill(pm1);
+ }
+ else
+ {
+ ParseBackColor(pm1);
+ }
+}
+
+/**
+* @descr: set page back color
+*
+*/
+void LwpPageLayout::ParseBackColor(XFPageMaster* pm1)
+{
+ LwpColor* pColor = GetBackColor();
+ if(pColor)
+ {
+ pm1->SetBackColor(XFColor(pColor->To24Color()));
+ }
+}
+
+/**
+* @descr: set page footnote separator information
+*
+*/
+void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1)
+{
+ //Get the footnoteoptions for the root document
+ LwpDocument* pDocument = m_pFoundry ? m_pFoundry->GetDocument() : nullptr;
+ if (!pDocument)
+ return;
+
+ LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
+
+ LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj().get()) : nullptr;
+ if(!pFootnoteOpts)
+ return;
+
+ LwpFootnoteSeparatorOptions& rFootnoteSep = pFootnoteOpts->GetFootnoteSeparator();
+ //set length
+ sal_uInt32 nLengthPercent = 100;
+ double fWidth = 0;
+ if(rFootnoteSep.HasSeparator())
+ {
+ fWidth = rFootnoteSep.GetTopBorderWidth();
+ }
+ if(rFootnoteSep.HasCustomLength())
+ {
+ const double fMarginWidth = GetMarginWidth();
+ if (fMarginWidth == 0.0)
+ throw o3tl::divide_by_zero();
+
+ nLengthPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength()) / fMarginWidth);
+ if (nLengthPercent > 100)
+ nLengthPercent = 100;
+ }
+ double fAbove = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetAbove());
+ double fBelow = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetBelow());
+ LwpColor aColor = rFootnoteSep.GetTopBorderColor();
+ enumXFAlignType eAlignType = enumXFAlignStart;
+ if(rFootnoteSep.GetIndent() > 0)
+ {
+ const double fMarginWidth = GetMarginWidth();
+ if (fMarginWidth == 0.0)
+ throw o3tl::divide_by_zero();
+
+ //SODC don't support indent
+ sal_uInt32 nIndentPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetIndent()) / fMarginWidth);
+ if (nIndentPercent + nLengthPercent >= 100)
+ eAlignType = enumXFAlignEnd;
+ }
+ if(aColor.IsValidColor())
+ {
+ XFColor aXFColor(aColor.To24Color());
+ pm1->SetFootNoteSeparator(eAlignType,fWidth, nLengthPercent, fAbove, fBelow, aXFColor);
+ }
+}
+
+/**
+* @descr: Register master page and page master style
+*
+*/
+void LwpPageLayout::RegisterStyle()
+{
+ std::unique_ptr<XFPageMaster> xpm1(new XFPageMaster);
+
+ ParseGeometry(xpm1.get());
+ //Does not process LayoutScale, for watermark is not supported in SODC.
+ ParseWaterMark(xpm1.get());
+ ParseMargins(xpm1.get());
+ ParseColumns(xpm1.get());
+ ParseBorders(xpm1.get());
+ ParseShadow(xpm1.get());
+ ParseBackGround(xpm1.get());
+ ParseFootNoteSeparator(xpm1.get());
+ xpm1->SetTextDir(GetTextDirection());
+
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(IsComplex() ||( pUseWhen && pUseWhen->IsUseOnAllOddPages()))
+ {
+ xpm1->SetPageUsage(enumXFPageUsageMirror);
+ }
+
+ //Add the page master to stylemanager
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFPageMaster* pm1 = static_cast<XFPageMaster*>(pXFStyleManager->AddStyle(std::move(xpm1)).m_pStyle);
+ m_pXFPageMaster = pm1;
+ OUString pmname = pm1->GetStyleName();
+
+ //Add master page
+ std::unique_ptr<XFMasterPage> p1(new XFMasterPage);
+ p1->SetStyleName(GetName().str());
+ p1->SetPageMaster(pmname);
+ XFMasterPage* p1_added = static_cast<XFMasterPage*>(pXFStyleManager->AddStyle(std::move(p1)).m_pStyle);
+ m_StyleName = p1_added->GetStyleName();
+
+ //Set footer style
+ LwpFooterLayout* pLayoutFooter = GetFooterLayout();
+ if(pLayoutFooter)
+ {
+ pLayoutFooter->SetFoundry(m_pFoundry);
+ pLayoutFooter->RegisterStyle(pm1);
+ pLayoutFooter->RegisterStyle(p1_added);
+ }
+
+ //Set header style
+ LwpHeaderLayout* pLayoutHeader = GetHeaderLayout();
+ if(pLayoutHeader)
+ {
+ pLayoutHeader->SetFoundry(m_pFoundry);
+ pLayoutHeader->RegisterStyle(pm1);
+ pLayoutHeader->RegisterStyle(p1_added);
+ }
+ //register child layout style for mirror page and frame
+ RegisterChildStyle();
+}
+
+/**
+* @descr: Register master page for endnote which name is "endnote"
+* @return: Return the master page name.
+*/
+OUString LwpPageLayout::RegisterEndnoteStyle()
+{
+ std::unique_ptr<XFPageMaster> pm1(new XFPageMaster);
+
+ ParseGeometry(pm1.get());
+ ParseWaterMark(pm1.get());
+ ParseMargins(pm1.get());
+ ParseColumns(pm1.get());
+ ParseBorders(pm1.get());
+ ParseShadow(pm1.get());
+ ParseBackGround(pm1.get());
+ pm1->SetTextDir(GetTextDirection());
+
+ LwpUseWhen* pUseWhen = GetUseWhen();
+ if(IsComplex() ||( pUseWhen && pUseWhen->IsUseOnAllOddPages()))
+ {
+ pm1->SetPageUsage(enumXFPageUsageMirror);
+ }
+
+ //Add the page master to stylemanager
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_pXFPageMaster = static_cast<XFPageMaster*>(pXFStyleManager->AddStyle(std::move(pm1)).m_pStyle);
+ OUString pmname = m_pXFPageMaster->GetStyleName();
+
+ //Add master page
+ std::unique_ptr<XFMasterPage> p1(new XFMasterPage);
+ p1->SetStyleName("Endnote");
+ p1->SetPageMaster(pmname);
+
+ //Set footer style
+ LwpFooterLayout* pLayoutFooter = GetFooterLayout();
+ if(pLayoutFooter)
+ {
+ pLayoutFooter->SetFoundry(m_pFoundry);
+ pLayoutFooter->RegisterStyle(m_pXFPageMaster);
+ pLayoutFooter->RegisterStyle(p1.get());
+ }
+
+ //Set header style
+ LwpHeaderLayout* pLayoutHeader = GetHeaderLayout();
+ if(pLayoutHeader)
+ {
+ pLayoutHeader->SetFoundry(m_pFoundry);
+ pLayoutHeader->RegisterStyle(m_pXFPageMaster);
+ pLayoutHeader->RegisterStyle(p1.get());
+ }
+
+ return pXFStyleManager->AddStyle(std::move(p1)).m_pStyle->GetStyleName();
+}
+/**
+* @descr: Whether current page layout has columns
+*
+*/
+bool LwpPageLayout::HasColumns()
+{
+ return GetNumCols() > 1;
+}
+
+/**
+* @descr: Whether has filler page text in current page layout
+*
+*/
+bool LwpPageLayout::HasFillerPageText(LwpFoundry const * pFoundry)
+{
+ if(!pFoundry) return false;
+
+ bool bFillerPage = false;
+ LwpLayout::UseWhenType eWhenType = GetUseWhenType();
+ if(eWhenType==LwpLayout::StartOnOddPage||eWhenType==LwpLayout::StartOnEvenPage)
+ {
+ //get the page number that current page layout inserted
+ sal_Int32 nPageNumber = GetPageNumber(FIRST_LAYOUTPAGENO)-1;
+
+ if(nPageNumber>0)
+ {
+ if((eWhenType==LwpLayout::StartOnOddPage)&&(LwpTools::IsOddNumber(nPageNumber)))
+ {
+ bFillerPage = true;
+ }
+ else if((eWhenType==LwpLayout::StartOnEvenPage)&&(LwpTools::IsEvenNumber(nPageNumber)))
+ {
+ bFillerPage = true;
+ }
+ else
+ {
+ bFillerPage = false;
+ }
+ }
+ }
+
+ return bFillerPage;
+}
+
+/**
+* @descr: Parse filler page text
+*
+*/
+void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
+{
+ if(!HasFillerPageText(m_pFoundry))
+ return;
+
+ //get fillerpage story from division info
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
+ LwpStory* pStory = pDivInfo ? dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get()) : nullptr;
+
+ //parse fillerpage story
+ if(pStory)
+ {
+ pStory->XFConvert(pCont);
+ }
+}
+/**
+* @descr: Clear columns style in page layout
+*
+*/
+void LwpPageLayout::ResetXFColumns()
+{
+ if(m_pXFPageMaster)
+ {
+ m_pXFPageMaster->SetColumns(nullptr);
+ }
+}
+
+LwpHeaderLayout* LwpPageLayout::GetHeaderLayout()
+{
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
+ {
+ if (xLay->GetLayoutType() == LWP_HEADER_LAYOUT)
+ return dynamic_cast<LwpHeaderLayout*>(xLay.get());
+ rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+ if (xNext == xLay)
+ {
+ SAL_WARN("lwp", "loop in layout");
+ break;
+ }
+ xLay = xNext;
+ }
+ return nullptr;
+}
+
+LwpFooterLayout* LwpPageLayout::GetFooterLayout()
+{
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
+ {
+ if (xLay->GetLayoutType() == LWP_FOOTER_LAYOUT)
+ return dynamic_cast<LwpFooterLayout*>(xLay.get());
+ rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+ if (xNext == xLay)
+ {
+ SAL_WARN("lwp", "loop in layout");
+ break;
+ }
+ xLay = xNext;
+ }
+ return nullptr;
+}
+
+/**
+* @descr: Get the odd layout if current page layout is mirror page
+*
+*/
+LwpPageLayout* LwpPageLayout::GetOddChildLayout()
+{
+ if(IsComplex())
+ {
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
+ {
+ if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
+ {
+ LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
+ LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
+ if(pUseWhen && pUseWhen->IsUseOnAllOddPages())
+ {
+ return pPageLayout;
+ }
+ }
+ xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+ }
+ }
+ return nullptr;
+}
+
+/**
+* @descr: Get margin width of page
+*
+*/
+double LwpPageLayout::GetMarginWidth()
+{
+ double fPagewidth = GetGeometryWidth();
+ double fLeftMargin = GetMarginsValue(MARGIN_LEFT);
+ double fRightMargin = GetMarginsValue(MARGIN_RIGHT);
+
+ return fPagewidth - (fLeftMargin + fRightMargin);
+}
+
+/**
+ * @descr: Get the pagenumber
+ * @param: if nLayoutNumber =FIRST_LAYOUTPAGENO, return the first page number that current page layout covers
+ =LAST_LAYOUTPAGENO, return the last page number that current page layout covers
+ else, return the specified page number that current page layout covers
+ * @param:
+ * @return: if return value >=0, success to find the page number, or fail.
+*/
+sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber)
+{
+ sal_Int16 nPageNumber = -1;
+ LwpFoundry* pFoundry = GetFoundry();
+ if (!pFoundry)
+ return nPageNumber;
+ LwpDocument* pDoc = pFoundry->GetDocument();
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDoc->GetPageHintsID().obj().get());
+ if(!pHeadTail) return nPageNumber;
+
+ //get first pagehint
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetHead().obj().get());
+ while(pPageHint)
+ {
+ if(GetObjectID() == pPageHint->GetPageLayoutID())
+ {
+ sal_uInt16 nNumber = pPageHint->GetPageNumber();
+ if(nLayoutNumber==FIRST_LAYOUTPAGENO && pPageHint->GetLayoutPageNumber()==1)
+ {
+ //get the first page number
+ nPageNumber = nNumber;
+ break;
+ }
+ else if( nLayoutNumber ==LAST_LAYOUTPAGENO && nNumber >nPageNumber )
+ {
+ //get the last page number
+ nPageNumber = nNumber;
+ if(pPageHint->GetNext().IsNull())
+ {
+ //if is last page number of entire document, return directly
+ return nPageNumber + pDoc->GetNumberOfPagesBefore();
+ }
+ }
+ else if(nLayoutNumber > 0 && pPageHint->GetLayoutPageNumber() == nLayoutNumber)
+ {
+ //get specified page number
+ nPageNumber = nNumber;
+ break;
+ }
+
+ }
+ pPageHint = dynamic_cast<LwpPageHint*>(pPageHint->GetNext().obj().get());
+ }
+ if(nPageNumber>=0)
+ {
+ return nPageNumber + 1 + pDoc->GetNumberOfPagesBefore();
+ }
+ return -1;
+}
+
+/**
+* @descr: Get page width and height
+*
+*/
+void LwpPageLayout::GetWidthAndHeight(double& fWidth, double& fHeight)
+{
+ //use customized size
+ LwpLayoutGeometry* pLayoutGeo = GetGeometry();
+ if(pLayoutGeo)
+ {
+ fWidth = GetGeometryWidth();
+ fHeight = GetGeometryHeight();
+ }
+
+ if(GetUsePrinterSettings())
+ {
+ //replaced by printer paper size
+ ScopedVclPtrInstance< Printer > pPrinter;
+ bool bScreen = pPrinter->IsDisplayPrinter();
+ if (!bScreen)//Printer available
+ {
+ Size aPaperSize = pPrinter->GetPaperSize();
+ aPaperSize = pPrinter->PixelToLogic( aPaperSize, MapMode( MapUnit::Map10thMM ) );
+ fWidth = static_cast<double>(aPaperSize.Width())/100; //cm unit
+ fHeight = static_cast<double>(aPaperSize.Height())/100;
+ }
+ }
+
+ //Follow the former design of Lotus WordPro filter, some default will be given:
+ //Page Width: 8.5 Inch -> 21.59 cm
+ //Page Height: 11 Inch -> 27.94 cm
+ if (fWidth < 4.39)
+ fWidth = 21.59;
+ if (fHeight < 4.49)
+ fHeight = 27.94;
+ //End of modification, by ZF
+}
+
+/**
+* @descr: Get page width
+*
+*/
+double LwpPageLayout::GetWidth()
+{
+ double fWidth =0, fHeight = 0;
+ GetWidthAndHeight(fWidth, fHeight);
+ return fWidth;
+}
+
+/**
+* @descr: Get page height
+*
+*/
+double LwpPageLayout::GetHeight()
+{
+ double fWidth =0, fHeight = 0;
+ GetWidthAndHeight(fWidth, fHeight);
+ return fHeight;
+}
+/**
+* @descr: Compare the position of layout. If the position of this layout is earlier than other layout,return true, or return false
+*
+*/
+bool LwpPageLayout::operator<(LwpPageLayout& Other)
+{
+ LwpPara* pThisPara = GetPagePosition();
+ LwpPara* pOtherPara = Other.GetPagePosition();
+ if(pThisPara && pOtherPara)
+ {
+ if(pThisPara == pOtherPara)
+ {
+ //If the two layouts in the same para, compare which layout is earlied according to frib order
+ return pThisPara->ComparePagePosition(this, &Other);
+ }
+ else
+ {
+ return *pThisPara < *pOtherPara;
+ }
+ }
+
+ return pThisPara == nullptr;
+}
+
+/**
+* @descr: Get the position of pagelayout
+*
+*/
+LwpPara* LwpPageLayout::GetPagePosition()
+{
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition().obj().get());
+ if(pPara)
+ return pPara;
+ //Get the position from its related section
+ LwpFoundry* pFoundry = GetFoundry();
+ if(pFoundry)
+ {
+ LwpSection* pSection = nullptr;
+ while( (pSection = pFoundry->EnumSections(pSection)) )
+ {
+ if(pSection->GetPageLayout() == this)
+ return dynamic_cast<LwpPara*>(pSection->GetPosition().obj().get());
+ }
+ }
+
+ return nullptr;
+}
+LwpHeaderLayout::LwpHeaderLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm )
+ : LwpPlacableLayout(objHdr, pStrm)
+ , m_nBorderOffset(0)
+{
+}
+
+LwpHeaderLayout::~LwpHeaderLayout()
+{
+}
+
+void LwpHeaderLayout::Read()
+{
+ LwpPlacableLayout::Read();
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000E)
+ m_nBorderOffset = m_pObjStrm->QuickReadInt32();
+ else
+ m_nBorderOffset = 0;
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpHeaderLayout::RegisterStyle(XFPageMaster* pm1)
+{
+ std::unique_ptr<XFHeaderStyle> xHeaderStyle(new XFHeaderStyle);
+
+ //Modify page top margin
+ //page top margin: from top of header to the top edge
+ double top = GetMarginsValue(MARGIN_TOP);
+ pm1->SetMargins(-1, -1, top, -1);
+
+ ParseMargins(xHeaderStyle.get());
+ ParseBorder(xHeaderStyle.get());
+ ParseShadow(xHeaderStyle.get());
+ ParseBackGround(xHeaderStyle.get());
+
+ ParseWaterMark(xHeaderStyle.get());
+ //End by
+
+ pm1->SetHeaderStyle(xHeaderStyle.release());
+}
+
+void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1)
+{
+ //Set height: from top of header to top of body, including the spacing between header and body
+ double height = GetGeometryHeight()- GetMarginsValue(MARGIN_TOP);
+ if (GetIsAutoGrowDown())
+ {
+ ph1->SetMinHeight(height);
+ }
+ else
+ {
+ ph1->SetHeight(height);
+ }
+
+ //Set left,right,bottom margins
+ LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent().obj().get());
+ //left margin in SODC: the space from the left edge of body to the left edge of header
+ double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0);
+ if(left<=0) //The left margin in SODC can not be minus value
+ {
+ left = -1;
+ }
+ //left margin in SODC: the space from the right edge of header to the right edge of body
+ double right = GetMarginsValue(MARGIN_RIGHT) - (parent ? parent->GetMarginsValue(MARGIN_RIGHT) : 0);
+ if(right<=0)//The right margin in SODC can not be minus value
+ {
+ right = -1;
+ }
+ ph1->SetMargins( left, right, GetMarginsValue(MARGIN_BOTTOM));
+
+ //Word Pro has no dynamic spacing, should be set to false
+ ph1->SetDynamicSpace(false);
+}
+
+void LwpHeaderLayout::ParseBorder(XFHeaderStyle* pHeaderStyle)
+{
+ std::unique_ptr<XFBorders> pBordres = GetXFBorders();
+ if(pBordres)
+ {
+ pHeaderStyle->SetBorders(std::move(pBordres));
+ }
+}
+
+void LwpHeaderLayout::ParseShadow(XFHeaderStyle* pHeaderStyle)
+{
+ XFShadow* pXFShadow = GetXFShadow();
+ if(pXFShadow)
+ {
+ pHeaderStyle->SetShadow(pXFShadow);
+ }
+}
+
+/**
+* @descr: set header back pattern
+*
+*/
+void LwpHeaderLayout::ParsePatternFill(XFHeaderStyle* pHeaderStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetFillPattern());
+ if (xXFBGImage)
+ {
+ pHeaderStyle->SetBackImage(xXFBGImage);
+ }
+}
+/**
+* @descr: set header background
+*
+*/
+void LwpHeaderLayout::ParseBackGround(XFHeaderStyle* pHeaderStyle)
+{
+ if (IsPatternFill())
+ {
+ ParsePatternFill(pHeaderStyle);
+ }
+ else
+ {
+ ParseBackColor(pHeaderStyle);
+ }
+}
+
+void LwpHeaderLayout::ParseBackColor(XFHeaderStyle* pHeaderStyle)
+{
+ LwpColor* pColor = GetBackColor();
+ if(pColor)
+ {
+ pHeaderStyle->SetBackColor(XFColor(pColor->To24Color()));
+ }
+}
+
+void LwpHeaderLayout::ParseWaterMark(XFHeaderStyle * pHeaderStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetXFBGImage());
+ if (xXFBGImage)
+ {
+ pHeaderStyle->SetBackImage(xXFBGImage);
+ }
+}
+//End by
+
+void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1)
+{
+ rtl::Reference<XFHeader> xHeader(new XFHeader);
+ rtl::Reference<LwpObject> pStory = m_Content.obj();
+ if(pStory.is())
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ pChangeMgr->SetHeadFootFribMap(true);
+
+ //Call the RegisterStyle first to register the styles in header paras, and then XFConvert()
+ pStory->SetFoundry(m_pFoundry);
+ pStory->DoRegisterStyle();
+ //, 06/27/2005
+ //register child layout style for framelayout,
+ RegisterChildStyle();
+ //End
+ pChangeMgr->SetHeadFootChange(xHeader.get());
+ pStory->DoXFConvert(xHeader.get());
+
+ pChangeMgr->SetHeadFootFribMap(false);
+ }
+ mp1->SetHeader(xHeader);
+}
+
+LwpFooterLayout::LwpFooterLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm )
+ : LwpPlacableLayout( objHdr, pStrm )
+ , m_nBorderOffset(0)
+{
+}
+
+LwpFooterLayout::~LwpFooterLayout()
+{
+}
+
+void LwpFooterLayout::Read()
+{
+ LwpPlacableLayout::Read();
+
+ if(LwpFileHeader::m_nFileRevision >= 0x000E)
+ m_nBorderOffset = m_pObjStrm->QuickReadInt32();
+ else
+ m_nBorderOffset = 0;
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpFooterLayout::RegisterStyle(XFPageMaster* pm1)
+{
+ std::unique_ptr<XFFooterStyle> xFooterStyle(new XFFooterStyle);
+
+ //Modify page bottom margin
+ //page bottom margin: from bottom of footer to the bottom edge
+ double bottom = GetMarginsValue(MARGIN_BOTTOM);
+ pm1->SetMargins(-1, -1, -1, bottom);
+
+ ParseMargins(xFooterStyle.get());
+ ParseBorder(xFooterStyle.get());
+ ParseShadow(xFooterStyle.get());
+ ParseBackGround(xFooterStyle.get());
+
+ ParseWaterMark(xFooterStyle.get());
+
+ pm1->SetFooterStyle(xFooterStyle.release());
+}
+
+void LwpFooterLayout::ParseMargins(XFFooterStyle* pFooterStyle)
+{
+
+ //Set height: from top of header to top of body, including the spacing between header and body
+ double height = GetGeometryHeight() - GetMarginsValue(MARGIN_BOTTOM);
+ if( IsAutoGrowUp() )
+ {
+ pFooterStyle->SetMinHeight(height);
+ }
+ else
+ {
+ pFooterStyle->SetHeight(height);
+ }
+
+ //Set left,right,top margins
+ LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent().obj().get());
+ double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0);
+ if(left<=0) //The left margin in SODC can not be minus value
+ {
+ left = -1;
+ }
+ double right = GetMarginsValue(MARGIN_RIGHT) - (parent ? parent->GetMarginsValue(MARGIN_RIGHT) : 0);
+ if(right<=0)//The left margin in SODC can not be minus value
+ {
+ right = -1;
+ }
+ pFooterStyle->SetMargins( left, right, GetMarginsValue(MARGIN_TOP));
+
+ //Word Pro has no dynamic spacing, should be set to false
+ pFooterStyle->SetDynamicSpace(false);
+}
+
+void LwpFooterLayout::ParseBorder(XFFooterStyle* pFooterStyle)
+{
+ std::unique_ptr<XFBorders> pBordres = GetXFBorders();
+ if(pBordres)
+ {
+ pFooterStyle->SetBorders(std::move(pBordres));
+ }
+}
+
+void LwpFooterLayout::ParseShadow(XFFooterStyle* pFooterStyle)
+{
+ XFShadow* pXFShadow = GetXFShadow();
+ if(pXFShadow)
+ {
+ pFooterStyle->SetShadow(pXFShadow);
+ }
+}
+/**
+* @descr: set footer back pattern
+*
+*/
+void LwpFooterLayout::ParsePatternFill(XFFooterStyle* pFooterStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetFillPattern());
+ if (xXFBGImage)
+ {
+ pFooterStyle->SetBackImage(xXFBGImage);
+ }
+}
+/**
+* @descr: set footer background
+*
+*/
+void LwpFooterLayout::ParseBackGround(XFFooterStyle* pFooterStyle)
+{
+ if (IsPatternFill())
+ {
+ ParsePatternFill(pFooterStyle);
+ }
+ else
+ {
+ ParseBackColor(pFooterStyle);
+ }
+}
+
+void LwpFooterLayout::ParseBackColor(XFFooterStyle* pFooterStyle)
+{
+ LwpColor* pColor = GetBackColor();
+ if(pColor)
+ {
+ pFooterStyle->SetBackColor(XFColor(pColor->To24Color()));
+ }
+}
+
+void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1)
+{
+ rtl::Reference<XFFooter> xFooter(new XFFooter);
+ rtl::Reference<LwpObject> pStory = m_Content.obj(VO_STORY);
+ //Call the RegisterStyle first to register the styles in footer paras, and then XFConvert()
+ if(pStory.is())
+ {
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
+ pChangeMgr->SetHeadFootFribMap(true);
+
+ pStory->SetFoundry(m_pFoundry);
+ pStory->DoRegisterStyle();
+ //register child layout style for framelayout,
+ RegisterChildStyle();
+
+ pChangeMgr->SetHeadFootChange(xFooter.get());
+
+ pStory->DoXFConvert(xFooter.get());
+
+ pChangeMgr->SetHeadFootFribMap(false);
+ }
+ mp1->SetFooter(xFooter);
+}
+
+void LwpFooterLayout::ParseWaterMark(XFFooterStyle * pFooterStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetXFBGImage());
+ if (xXFBGImage)
+ {
+ pFooterStyle->SetBackImage(xXFBGImage);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppagelayout.hxx b/lotuswordpro/source/filter/lwppagelayout.hxx
new file mode 100644
index 000000000..68402d3e0
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppagelayout.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPAGELAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPAGELAYOUT_HXX
+
+#include "lwplayout.hxx"
+#include <xfilter/xfmasterpage.hxx>
+
+
+class LwpHeaderLayout;
+class LwpFooterLayout;
+
+class LwpPageLayout final : public LwpLayout
+{
+public:
+ LwpPageLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpPageLayout() override;
+ virtual void RegisterStyle() override;
+ OUString RegisterEndnoteStyle();
+ virtual void Parse(IXFStream* pOutputStream) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_PAGE_LAYOUT;}
+
+private:
+ void Read() override;
+ LwpHeaderLayout* GetHeaderLayout();
+ LwpFooterLayout* GetFooterLayout();
+ void ParseGeometry(XFPageMaster* pm1);
+ void ParseMargins(XFPageMaster* pm1);
+ void ParseBorders(XFPageMaster* pm1);
+ void ParsePatternFill(XFPageMaster* pm1);
+ void ParseBackGround(XFPageMaster* pm1);
+ void ParseBackColor(XFPageMaster* pm1);
+ void ParseWaterMark(XFPageMaster* pm1);
+ void ParseColumns(XFPageMaster* pm1);
+ void ParseShadow(XFPageMaster* pm1);
+ void ParseFootNoteSeparator(XFPageMaster* pm1);
+ double GetMarginWidth();
+ void GetWidthAndHeight(double& fWidth, double& fHeight);
+ double GetWidth() override;
+ double GetHeight() override;
+ LwpAtomHolder m_PrinterBinName;
+ sal_uInt16 m_nPrinterBin;
+ sal_Int32 m_nBdroffset;
+ LwpAtomHolder m_PaperName;
+ XFPageMaster* m_pXFPageMaster;
+public:
+ bool HasColumns();
+ bool HasFillerPageText(LwpFoundry const * pFoundry);
+ void ConvertFillerPageText(XFContentContainer* pCont);
+ void ResetXFColumns();
+ LwpPageLayout* GetOddChildLayout();
+ virtual sal_Int32 GetPageNumber(sal_uInt16 nLayoutNumber) override;
+ bool operator <(LwpPageLayout& Other);
+ LwpPara* GetPagePosition();
+};
+
+class LwpHeaderLayout: public LwpPlacableLayout
+{
+public:
+ LwpHeaderLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpHeaderLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HEADER_LAYOUT;}
+ using LwpPlacableLayout::RegisterStyle;
+ void RegisterStyle( XFPageMaster* pm1 );
+ void RegisterStyle( XFMasterPage* mp1 );
+protected:
+ void Read() override;
+ void ParseMargins( XFHeaderStyle* ph1 );
+ void ParseBorder( XFHeaderStyle* ph1 );
+ void ParseShadow( XFHeaderStyle* ph1 );
+ void ParsePatternFill(XFHeaderStyle* ph1);
+ void ParseBackGround(XFHeaderStyle* ph1);
+ void ParseBackColor(XFHeaderStyle* ph1);
+
+ void ParseWaterMark(XFHeaderStyle* ph1);
+private:
+ sal_Int32 m_nBorderOffset;
+};
+
+class LwpFooterLayout: public LwpPlacableLayout
+{
+public:
+ LwpFooterLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpFooterLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_FOOTER_LAYOUT;}
+ using LwpPlacableLayout::RegisterStyle;
+ void RegisterStyle(XFPageMaster* pm1);
+ void RegisterStyle(XFMasterPage* mp1);
+protected:
+ void Read() override;
+ void ParseMargins( XFFooterStyle* pFooterStyle );
+ void ParseBorder( XFFooterStyle* pFooterStyle );
+ void ParseShadow( XFFooterStyle* pFooterStyle );
+ void ParsePatternFill(XFFooterStyle* pFooterStyle);
+ void ParseBackGround(XFFooterStyle* pFooterStyle);
+
+ void ParseBackColor(XFFooterStyle* pFooterStyle);
+
+ void ParseWaterMark(XFFooterStyle* pFooterStyle);
+
+private:
+ sal_Int32 m_nBorderOffset;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
new file mode 100644
index 000000000..6dfe95bb1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -0,0 +1,866 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwppara.hxx"
+#include <lwpglobalmgr.hxx>
+#include <lwpfilehdr.hxx>
+#include "lwpparaproperty.hxx"
+#include <lwptools.hxx>
+#include "lwpparastyle.hxx"
+#include <xfilter/xffont.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xftabstop.hxx>
+#include <xfilter/xflinebreak.hxx>
+#include <xfilter/xfsection.hxx>
+#include <xfilter/xfsectionstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfhyperlink.hxx>
+#include <xfilter/xfliststyle.hxx>
+#include "lwpcharsetmgr.hxx"
+#include "lwpfribheader.hxx"
+#include "lwpsection.hxx"
+#include "lwplayout.hxx"
+#include "lwpusewhen.hxx"
+#include "lwpbulletstylemgr.hxx"
+#include "lwpstory.hxx"
+#include "lwpsilverbullet.hxx"
+#include <xfilter/xflist.hxx>
+#include <xfilter/xfframe.hxx>
+
+#include "lwpdivinfo.hxx"
+#include "lwpdoc.hxx"
+#include "lwpholder.hxx"
+#include "lwppagehint.hxx"
+
+#include <lwpdropcapmgr.hxx>
+#include "lwptable.hxx"
+#include <memory>
+#include <o3tl/sorted_vector.hxx>
+
+LwpPara::LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm)
+ , m_nOrdinal(0)
+ , m_nFlags(0)
+ , m_nLevel(0)
+ , m_FontID(0)
+ , m_AllText("")
+ , m_bHasBullet(false)
+ , m_pSilverBullet(nullptr)
+ , m_bBullContinue(false)
+ , m_SectionStyleName("")
+ , m_bHasDropcap(false)
+ , m_nLines(0)
+ , m_nChars(0)
+ , m_pDropcapLayout(nullptr)
+ , m_BelowSpacing(0)
+{
+}
+
+LwpPara::~LwpPara()
+{
+}
+
+void LwpPara::Read()
+{
+ LwpDLVList::Read();
+
+ bool Simple;
+ bool Notify = false;
+ if(LwpFileHeader::m_nFileRevision<0x0006)
+ Simple = false;
+ else if(LwpFileHeader::m_nFileRevision<0x000B)
+ Simple = m_pObjStrm->QuickReaduInt8() != 0;
+ else
+ {
+ sal_uInt8 Flag = m_pObjStrm->QuickReaduInt8();
+
+ const int DISK_SIMPLE = 1;
+ const int DISK_NOTIFY = 2;
+
+ Simple = (Flag & DISK_SIMPLE) != 0;
+ Notify = (Flag & DISK_NOTIFY) != 0;
+ }
+
+ if(!Simple)
+ {
+ m_nOrdinal = m_pObjStrm->QuickReaduInt32();
+ if(LwpFileHeader::m_nFileRevision<0x000B)
+ {
+ assert(false);
+ }
+ else
+ {
+ if (Notify)
+ {
+ std::unique_ptr<LwpForked3NotifyList> pNotifyList( new LwpForked3NotifyList );
+ pNotifyList->GetExtraList().Read(m_pObjStrm.get());
+ pNotifyList->Read(m_pObjStrm.get());
+ }
+ }
+ }
+ else
+ m_nOrdinal = 0x0001;
+
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ m_ParaStyle.ReadIndexed(m_pObjStrm.get());
+
+ if(!Simple)
+ {
+ m_Hint.Read(m_pObjStrm.get());
+ }
+
+ m_Story.ReadIndexed(m_pObjStrm.get());
+ if(!Simple)
+ {
+ if(LwpFileHeader::m_nFileRevision<0x000B)
+ {
+ // TODO: to process
+ assert(false);
+ }
+ m_nLevel = m_pObjStrm->QuickReaduInt16();
+
+ if (m_nLevel > 9)
+ {
+ m_nLevel = 9;
+ }
+ }
+ else
+ m_nLevel = 0x0001;
+
+ m_Fribs.SetPara(this);// for silver bullet
+ m_Fribs.ReadPara(m_pObjStrm.get());
+
+ ReadPropertyList(m_pObjStrm.get());
+}
+
+void LwpPara::Parse(IXFStream* pOutputStream)
+{
+ m_xXFContainer.set(new XFContentContainer);
+ XFConvert(m_xXFContainer.get());
+ if (!m_xXFContainer)
+ return;
+ m_xXFContainer->ToXml(pOutputStream);
+ m_xXFContainer->Reset();
+ m_xXFContainer.clear();
+}
+
+void LwpPara::XFConvert(XFContentContainer* pCont)
+{
+ m_xXFContainer.set(pCont);
+
+ LwpStory *pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
+
+ if (pStory && pStory->GetDropcapFlag())
+ {
+ ParseDropcapContent();
+ return;
+ }
+
+ //Add the break before para
+ if (m_pBreaks && m_nOrdinal!=0)
+ AddBreakBefore(pCont);
+
+ //Create an XFPara for this VO_PARA
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(m_StyleName);
+
+ if(!m_SectionStyleName.isEmpty())
+ {
+ rtl::Reference<XFSection> xSection(CreateXFSection());
+ if (pStory)
+ pStory->AddXFContent(xSection.get());
+ m_xXFContainer.set(xSection.get());
+ }
+
+ if (m_bHasBullet && m_pSilverBullet)
+ {
+ rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_xXFContainer.get());
+ if (xListItem)
+ {
+ xListItem->Add(xPara.get());
+ }
+ }
+ else if (m_xXFContainer)
+ {
+ LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
+ if (pBulletStyleMgr)
+ {
+ pBulletStyleMgr->SetCurrentSilverBullet(LwpObjectID());
+ pBulletStyleMgr->SetContinueFlag(false);
+ }
+ m_xXFContainer->Add(xPara.get());
+ }
+
+ m_Fribs.SetXFPara(xPara.get());
+ m_Fribs.XFConvert();
+
+ if (m_pBreaks && m_xXFContainer)
+ AddBreakAfter(m_xXFContainer.get());
+}
+
+void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle)
+{
+ //get story
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
+ //if pagelayout is modified, register the pagelayout
+ if(!(pStory && pStory->IsPMModified()))
+ return;
+
+ bool bNewSection = pStory->IsNeedSection();
+ LwpPageLayout* pLayout = pStory->GetCurrentLayout();
+ if(bNewSection)
+ {
+ RegisterNewSectionStyle(pLayout);
+ }
+
+ //register master page style
+ std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
+ *xOverStyle = *pBaseStyle;
+ xOverStyle->SetStyleName( "");
+ xOverStyle->SetMasterPage(pLayout->GetStyleName());
+ if (!m_ParentStyleName.isEmpty())
+ xOverStyle->SetParentStyleName(m_ParentStyleName);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+}
+/**
+ * @short register paragraph style
+ */
+void LwpPara::RegisterStyle()
+{ //1 reg autostyle
+// m_Fribs.SetPara(this);
+// m_Fribs.RegisterStyle();
+
+ //2 reg para style
+ if (!m_pFoundry)
+ return;
+ XFParaStyle* pBaseStyle = dynamic_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(m_ParaStyle));
+ if (pBaseStyle == nullptr) return;
+ m_StyleName = pBaseStyle->GetStyleName();//such intf to be added
+ m_ParentStyleName = m_StyleName;
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ if (pParaStyle && pParaStyle->GetIndent())
+ {
+ std::unique_ptr<LwpIndentOverride> pIndentOverride(GetParaStyle()->GetIndent()->clone());
+ m_pIndentOverride = std::move(pIndentOverride);
+ }
+
+ std::unique_ptr<XFParaStyle> xOverStyle;
+ bool noSpacing = true;
+ LwpParaProperty* pBulletProps = nullptr, *pNumberingProps = nullptr;
+
+ if (!m_vProps.empty())
+ {
+ bool noIndent = true;
+ xOverStyle.reset(new XFParaStyle);
+ *xOverStyle = *pBaseStyle;
+ xOverStyle->SetStyleName("");
+ sal_uInt32 PropType;
+ LwpParaStyle& rParaStyle = dynamic_cast<LwpParaStyle&>(*m_ParaStyle.obj());
+ for (auto & pProps : m_vProps)
+ {
+ PropType = pProps->GetType();
+ switch(PropType)
+ {
+ case PP_LOCAL_ALIGN:
+ {
+ LwpAlignmentOverride *pAlignment = static_cast<LwpParaAlignProperty*>(pProps.get())->GetAlignment();
+ if (pAlignment)
+ {
+ if (!rParaStyle.GetAlignment())
+ OverrideAlignment(nullptr, pAlignment, xOverStyle.get());
+ else
+ {
+ std::unique_ptr<LwpAlignmentOverride> const pAlign(
+ rParaStyle.GetAlignment()->clone());
+ OverrideAlignment(pAlign.get(),
+ pAlignment,
+ xOverStyle.get());
+ }
+ }
+ break;
+ }
+ case PP_LOCAL_INDENT:
+ {
+ noIndent = false;
+ LwpIndentOverride *pIndent = static_cast<LwpParaIndentProperty*>(pProps.get())->GetIndent();
+ if (pIndent)
+ {
+ if (!rParaStyle.GetIndent())
+ OverrideIndent(nullptr, pIndent, xOverStyle.get());
+ else
+ OverrideIndent(m_pIndentOverride.get(), pIndent, xOverStyle.get());
+ }
+ break;
+ }
+ case PP_LOCAL_SPACING:
+ {
+ noSpacing = false;
+ LwpSpacingOverride *pSpacing = static_cast<LwpParaSpacingProperty*>(pProps.get())->GetSpacing();
+ if (pSpacing)
+ {
+ if (!rParaStyle.GetSpacing())
+ OverrideSpacing(nullptr, pSpacing, xOverStyle.get());
+ else
+ {
+ std::unique_ptr<LwpSpacingOverride> const
+ pNewSpacing(rParaStyle.GetSpacing()->clone());
+ OverrideSpacing(pNewSpacing.get(), pSpacing, xOverStyle.get());
+ }
+ }
+ break;
+ }
+ case PP_LOCAL_BORDER:
+ {
+ OverrideParaBorder(pProps.get(), xOverStyle.get());
+ break;
+ }
+ case PP_LOCAL_BREAKS:
+ {
+ OverrideParaBreaks(pProps.get(), xOverStyle.get());
+ break;
+ }
+ case PP_LOCAL_BULLET:
+ {
+ pBulletProps = pProps.get();
+ break;
+ }
+ case PP_LOCAL_NUMBERING:
+ {
+ pNumberingProps = pProps.get();
+ break;
+ }
+ case PP_LOCAL_TABRACK:
+ {
+ break;
+ }
+ case PP_LOCAL_BACKGROUND:
+ {
+ LwpBackgroundOverride* pBGOver = static_cast<LwpParaBackGroundProperty*>(pProps.get())->GetBackground();
+ if (pBGOver)
+ {
+ LwpBackgroundStuff& rBGStuff = pBGOver->GetBGStuff();
+ if (!rBGStuff.IsTransparent() )
+ {
+ if (rBGStuff.IsPatternFill())
+ {
+ std::unique_ptr<XFBGImage> xXFBGImage(rBGStuff.GetFillPattern());
+ xOverStyle->SetBackImage(xXFBGImage);
+ }
+ else
+ {
+ LwpColor* pColor = rBGStuff.GetFillColor();
+ if (pColor && pColor->IsValidColor())
+ {
+ XFColor aXFColor( pColor->To24Color());
+ xOverStyle->SetBackColor( aXFColor );
+ }
+ }
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if (noIndent && m_pIndentOverride)
+ {
+ if (m_pIndentOverride->IsUseRelative() && GetParent())
+ {
+ OverrideIndent(nullptr,m_pIndentOverride.get(),xOverStyle.get());
+ }
+ }
+ if (!m_ParentStyleName.isEmpty())
+ xOverStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+
+ }
+ else //use named style
+ {
+ if (m_pIndentOverride)
+ {
+ if (m_pIndentOverride->IsUseRelative() && GetParent())
+ {
+ xOverStyle.reset(new XFParaStyle);
+ *xOverStyle = *pBaseStyle;
+ OverrideIndent(nullptr,m_pIndentOverride.get(),xOverStyle.get());
+ if (!m_ParentStyleName.isEmpty())
+ xOverStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+ }
+ }
+ }
+
+ if (IsInCell())
+ {
+ XFParaStyle* pOldStyle = pXFStyleManager->FindParaStyle(m_StyleName);
+ if (pOldStyle->GetNumberRight())
+ {
+ xOverStyle.reset(new XFParaStyle);
+ *xOverStyle = *pOldStyle;
+ xOverStyle->SetAlignType(enumXFAlignStart);
+ if (!m_ParentStyleName.isEmpty())
+ xOverStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+ }
+ }
+
+ // override bullet and numbering
+ OverrideParaBullet(pBulletProps);
+ OverrideParaNumbering(pNumberingProps);
+
+ //register bullet style
+ LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
+ if (pBulletStyleMgr)
+ {
+ // if has bullet or numbering
+ if (m_bHasBullet)
+ {
+ //if it's normal bullet
+ if (m_pSilverBullet)
+ {
+ if (m_pSilverBullet->HasName())
+ {
+ m_aBulletStyleName = m_pSilverBullet->GetBulletStyleName();
+ }
+ else if (!m_xBullOver->IsEditable())
+ {
+ m_aBulletStyleName = pBulletStyleMgr->RegisterBulletStyle(this, m_xBullOver.get(), m_pIndentOverride.get());
+ }
+
+ // test codes
+ if (m_pSilverBullet->IsBulletOrdered())
+ {
+ OUString aPreBullStyleName;
+ LwpNumberingOverride* pNumbering = GetParaNumbering();
+ sal_uInt16 nPosition = pNumbering->GetPosition();
+ bool bLesser = m_pSilverBullet->IsLesserLevel(nPosition);
+ LwpPara* pPara = this;
+ LwpPara* pPrePara = nullptr;
+ sal_uInt16 nNum = 0, nLevel = 0, nFoundLevel = 0xffff, nFoundBound = 0;
+
+ nFoundBound = nLevel = pNumbering->GetLevel();
+ if (nPosition == pNumbering->GetPosition())
+ {
+ nFoundBound++;
+ }
+ bool bHeading = pNumbering->IsHeading();
+
+ o3tl::sorted_vector<LwpPara*> aSeen;
+ while(true)
+ {
+ aSeen.insert(pPara);
+ LwpSilverBullet* pParaSilverBullet = pPara->GetSilverBullet();
+ pNumbering = pPara->GetParaNumbering();
+
+ if (pPara->GetObjectID() != GetObjectID())
+ {
+ if (!pParaSilverBullet)
+ {
+ break;
+ }
+
+ /* If lesser, stop when we hit an outline style whose level is
+ * higher than our current level.
+ */
+ // restart based on Outline level?
+ if (pNumbering && bLesser && (!bHeading || pNumbering->IsHeading()))
+ {
+ if (nFoundLevel != 0xffff)
+ {
+ if (pNumbering->GetLevel() < nFoundLevel)
+ {
+ break;
+ }
+ if ((pNumbering->GetLevel() == nFoundLevel)
+ && (pParaSilverBullet->GetObjectID() != m_pSilverBullet->GetObjectID()
+ || pNumbering->GetPosition() != nPosition))
+ {
+ break;
+ }
+ }
+ else
+ {
+ if (pNumbering->GetLevel() < nFoundBound
+ && (pParaSilverBullet->GetObjectID() != m_pSilverBullet->GetObjectID()
+ || pNumbering->GetPosition() != nPosition))
+ {
+ nFoundBound = pNumbering->GetLevel();
+ }
+ }
+ }
+ }
+
+ // Don't bump the number if this bullet is skipped
+ if (m_xBullOver->IsSkip())
+ ;
+ else if ( pParaSilverBullet
+ && pParaSilverBullet->GetObjectID() == m_pSilverBullet->GetObjectID()
+ && pNumbering && nPosition == pNumbering->GetPosition())
+ {
+ if (bLesser)
+ {
+ if (nFoundLevel != 0xffff)
+ {
+ if (nFoundLevel == pNumbering->GetLevel())
+ {
+ aPreBullStyleName = pPara->GetBulletStyleName();
+ nNum++;
+ }
+ }
+ else if (pNumbering->GetLevel() <= nLevel)
+ {
+ if (pNumbering->GetLevel() >= nFoundBound)
+ {
+ break;
+ }
+ nFoundLevel = pNumbering->GetLevel();
+ aPreBullStyleName = pPara->GetBulletStyleName();
+ nNum++;
+ }
+ }
+ else
+ {
+ aPreBullStyleName = pPara->GetBulletStyleName();
+ nNum++;
+ }
+ }
+
+ pPrePara = dynamic_cast<LwpPara*>(pPara->GetPrevious().obj(VO_PARA).get());
+
+ if (!pPrePara)
+ {
+ LwpStory* pStory = pPara->GetStory();
+ pPrePara = pStory ? pStory->GetLastParaOfPreviousStory() : nullptr;
+
+ if (!pPrePara)
+ {
+ break;
+ }
+ }
+ pPara = pPrePara;
+ if (aSeen.find(pPara) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ nNum = nNum ? nNum : 1;
+
+ if (nNum > 1)
+ {
+ m_aBulletStyleName = aPreBullStyleName;
+ m_bBullContinue = true;
+ }
+ else
+ {
+ m_bBullContinue = false;
+ if (IsInCell())
+ {
+ XFListStyle* pOldStyle = static_cast<XFListStyle*>(pXFStyleManager->FindStyle(m_aBulletStyleName));
+ if (pOldStyle)
+ {
+ std::unique_ptr<XFListStyle> xNewStyle(new XFListStyle(*pOldStyle));
+ m_aBulletStyleName = pXFStyleManager->AddStyle(std::move(xNewStyle)).m_pStyle->GetStyleName();
+ }
+ }
+ }
+
+ LwpStory* pMyStory = GetStory();
+ if (pMyStory)
+ {
+ if (pMyStory->IsBullStyleUsedBefore(m_aBulletStyleName, m_xParaNumbering->GetPosition()))
+ {
+ //m_bBullContinue = sal_True;
+ }
+ else
+ {
+ pMyStory->AddBullStyleName2List(m_aBulletStyleName, m_xParaNumbering->GetPosition());
+ }
+ }
+
+ }
+ // end of test codes
+ }
+ }
+ }
+
+ if (noSpacing)
+ {
+ LwpPara* pPrePara = dynamic_cast<LwpPara*>(GetPrevious().obj().get());
+ if (pPrePara && pPrePara->GetBelowSpacing()!=0)
+ {
+ xOverStyle.reset(new XFParaStyle);
+ *xOverStyle = *GetXFParaStyle();
+ XFMargins* pMargin = &xOverStyle->GetMargins();
+ pMargin->SetTop(pMargin->GetTop()+pPrePara->GetBelowSpacing());
+ if (!m_ParentStyleName.isEmpty())
+ xOverStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+ }
+ }
+
+ //register tab style
+ if(m_Fribs.HasFrib(FRIB_TAG_TAB))
+ {
+ std::unique_ptr<XFParaStyle> xNewParaStyle(new XFParaStyle);
+ *xNewParaStyle = *GetXFParaStyle();
+ //xOverStyle->SetStyleName("");
+ RegisterTabStyle(xNewParaStyle.get());
+ if (!m_ParentStyleName.isEmpty())
+ xNewParaStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xNewParaStyle)).m_pStyle->GetStyleName();
+ }
+
+ //register master page;
+ RegisterMasterPage(GetXFParaStyle());
+
+ // reg auto style,lay here for pagebreak need overridden para style
+ m_Fribs.SetPara(this);
+ m_Fribs.RegisterStyle();
+
+ if (m_bHasDropcap)
+ {
+ GatherDropcapInfo();
+ std::unique_ptr<XFParaStyle> xStyle(new XFParaStyle);
+ *xStyle = *GetXFParaStyle();
+ xStyle->SetDropCap(m_nChars-1,m_nLines);
+ if (!m_ParentStyleName.isEmpty())
+ xStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xStyle)).m_pStyle->GetStyleName();
+ }
+ // maybe useful for further version
+ // deleted because Leader of Table is not supported in this version
+ //AddTabStyleForTOC();
+}
+
+void LwpPara::RegisterNewSectionStyle(LwpPageLayout *pLayout)
+{
+ if( !pLayout )
+ return;
+
+ std::unique_ptr<XFSectionStyle> xSectStyle(new XFSectionStyle);
+ XFColumns* pColumns = pLayout->GetXFColumns();
+ if(pColumns)
+ {
+ xSectStyle->SetColumns(pColumns);
+ }
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_SectionStyleName = pXFStyleManager->AddStyle(std::move(xSectStyle)).m_pStyle->GetStyleName();
+}
+
+rtl::Reference<XFSection> LwpPara::CreateXFSection()
+{
+ rtl::Reference<XFSection> xXFSection(new XFSection);
+ xXFSection->SetStyleName(m_SectionStyleName);
+ m_SectionStyleName.clear();
+ return xXFSection;
+}
+
+/**************************************************************************
+ * @descr: register tab style
+**************************************************************************/
+void LwpPara::RegisterTabStyle(XFParaStyle* pXFParaStyle)
+{
+ LwpTabOverride aFinaOverride;
+ LwpTabOverride* pBase = nullptr;
+ //get the tabrack from the current layout
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
+ LwpMiddleLayout* pLayout = pStory ? pStory->GetTabLayout() : nullptr;
+ if(pLayout)
+ {
+ pBase = pLayout->GetTabOverride();
+ if(pBase)
+ {
+ pBase->Override(&aFinaOverride);
+ }
+ }
+
+ //get the tabrack from the base parastyle
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ pBase = pParaStyle->GetTabOverride();
+ if(pBase)
+ {
+ pBase->Override(&aFinaOverride);
+ }
+ //get the tabrack from the local property
+ pBase = GetLocalTabOverride();
+ if(pBase)
+ {
+ pBase->Override(&aFinaOverride);
+ }
+
+ LwpParaStyle::ApplyTab(pXFParaStyle, &aFinaOverride);
+}
+/**
+ * @short parse dropcap text
+ */
+void LwpPara::ParseDropcapContent()
+{
+ if (!GetFoundry())
+ return;
+ XFParagraph* pDropcap = GetFoundry()->GetDropcapMgr()->GetXFPara();
+ if (pDropcap)
+ {
+ m_Fribs.SetXFPara(pDropcap);
+ m_Fribs.XFConvert();
+ }
+}
+/**
+ * @short add paragraph break attribute
+ */
+void LwpPara::AddBreakBefore(XFContentContainer* pCont)
+{
+ if (!m_pBreaks || !pCont)
+ return;
+ if (m_pBreaks->IsPageBreakBefore())
+ {
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(m_BefPageBreakName);
+ pCont->Add(xPara.get());
+ }
+ else if (m_pBreaks->IsColumnBreakBefore())
+ {
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(m_BefColumnBreakName);
+ pCont->Add(xPara.get());
+ }
+}
+
+void LwpPara::AddBreakAfter(XFContentContainer* pCont)
+{
+ if (!m_pBreaks)
+ return;
+ if (m_pBreaks->IsPageBreakAfter())
+ {
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(m_AftPageBreakName);
+ pCont->Add(xPara.get());
+ }
+ else if (m_pBreaks->IsColumnBreakAfter())
+ {
+ rtl::Reference<XFParagraph> xPara(new XFParagraph);
+ xPara->SetStyleName(m_AftColumnBreakName);
+ pCont->Add(xPara.get());
+ }
+}
+
+LwpBulletStyleMgr* LwpPara::GetBulletStyleMgr()
+{
+ if (m_pFoundry)
+ {
+ return m_pFoundry->GetBulletStyleMgr();
+ }
+
+ return nullptr;
+}
+
+rtl::Reference<XFContentContainer> LwpPara::AddBulletList(XFContentContainer* pCont)
+{
+ LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
+ if (!pBulletStyleMgr)
+ {
+ assert(false);
+ return rtl::Reference<XFContentContainer>();
+ }
+
+ sal_uInt16 nLevel = m_nLevel;
+ bool bOrdered = false;
+ /*LwpStory* pMyStory =*/ GetStory();
+
+ pBulletStyleMgr->SetContinueFlag(m_bBullContinue);
+
+ if (m_pSilverBullet->IsBulletOrdered())
+ {
+ bOrdered = true;
+ }
+ if (m_pSilverBullet->HasName())
+ {
+ nLevel = m_xParaNumbering->GetPosition();
+ m_nLevel = nLevel;//for get para level
+ }
+
+ return pBulletStyleMgr->AddBulletList(pCont, bOrdered, m_aBulletStyleName,
+ nLevel, m_xBullOver->IsSkip());
+}
+
+LwpNumberingOverride* LwpPara::GetParaNumbering()
+{
+ return m_xParaNumbering.get();
+}
+
+void LwpForked3NotifyList::Read(LwpObjectStream* pObjStrm)
+{
+ m_PersistentList.Read(pObjStrm);
+}
+
+void LwpNotifyListPersistent::Read(LwpObjectStream* pObjStrm)
+{
+ m_Head.ReadIndexed(pObjStrm);
+ pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx
new file mode 100644
index 000000000..4815d1661
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppara.hxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * LwpPara: Word Pro object for paragraph
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
+
+#include <memory>
+#include <config_lgpl.h>
+
+#include <lwpobj.hxx>
+#include <lwpobjstrm.hxx>
+
+#include <vector>
+#include "lwpdlvlist.hxx"
+#include <lwpbasetype.hxx>
+#include <lwpoverride.hxx>
+#include <lwpfoundry.hxx>
+#include "lwplayout.hxx"
+#include "lwpfribptr.hxx"
+#include "lwpfribtext.hxx"
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xfsection.hxx>
+
+class LwpParaProperty;
+class LwpPara;
+class LwpBreaksOverride;
+class LwpBulletStyleMgr;
+
+class LwpNotifyListPersistent final
+{
+public:
+ LwpNotifyListPersistent(){}
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpObjectID m_Head;
+};
+
+class LwpForked3NotifyList final
+{
+public:
+ LwpForked3NotifyList(){}
+ LwpNotifyListPersistent& GetExtraList() { return m_ExtraList; }
+ void Read(LwpObjectStream* pObjStrm);
+private:
+ LwpNotifyListPersistent m_ExtraList;
+ LwpNotifyListPersistent m_PersistentList;
+};
+
+class LwpParaStyle;
+class LwpTabOverride;
+class LwpNumberingOverride;
+class LwpSilverBullet;
+class LwpPageLayout;
+
+struct ParaNumbering
+{
+ LwpFribText* pPrefix;
+ LwpFribParaNumber* pParaNumber;
+ LwpFribText* pSuffix;
+
+ sal_uInt16 nNumLevel;//hidelevels of paranumber frib
+
+ ParaNumbering()
+ {
+ clear();
+ }
+
+ void clear()
+ {
+ pPrefix = nullptr;
+ pParaNumber = nullptr;
+ pSuffix = nullptr;
+ nNumLevel = 0;
+ }
+};
+
+class LwpDropcapLayout;
+class LwpPara : public LwpDLVList
+{
+public:
+ LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+
+ void Read() override;
+ void RegisterStyle() override;
+ void Parse(IXFStream* pOutputStream) override;
+ void XFConvert(XFContentContainer* pCont) override;
+
+ LwpPara* GetParent();
+ LwpObjectID& GetStoryID();
+ LwpStory* GetStory();
+
+ LwpParaStyle* GetParaStyle();
+ XFParaStyle* GetXFParaStyle();
+ LwpIndentOverride* GetIndent();
+ LwpTabOverride* GetLocalTabOverride();
+ LwpNumberingOverride* GetParaNumbering();
+
+ inline LwpSilverBullet* GetSilverBullet();
+ const OUString& GetBulletChar() const;
+ sal_uInt32 GetBulletFontID() const;
+ sal_uInt16 GetLevel() const;
+ bool GetBulletFlag() const;
+
+ void GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering);
+ LwpFribPtr& GetFribs();
+ double GetBelowSpacing() const;
+ LwpParaProperty* GetProperty(sal_uInt32 nPropType);
+ void GatherDropcapInfo();
+ const OUString& GetBulletStyleName() const;
+ void SetBelowSpacing(double value);
+ void SetBulletFlag(bool bFlag);
+ void SetIndent(LwpIndentOverride* pIndentOverride);
+ void SetFirstFrib(const OUString& Content,sal_uInt32 FontID);
+ OUString const & GetContentText(bool bAllText = false);
+
+ void SetParaDropcap(bool bFlag);
+ void SetDropcapLayout(LwpDropcapLayout* pLayout);
+
+ XFContentContainer* GetXFContainer();
+ void AddXFContent(XFContent* pCont);
+ void SetXFContainer(XFContentContainer* pCont);
+ void RegisterTabStyle(XFParaStyle* pXFParaStyle);
+
+ LwpBulletStyleMgr* GetBulletStyleMgr();
+ bool operator <(LwpPara const & Other);
+ bool ComparePagePosition(LwpVirtualLayout const * pPreLayout, LwpVirtualLayout const * pNextLayout);
+
+ bool IsInCell();
+
+ void SetAllText(const OUString& sText);
+
+protected:
+ sal_uInt32 m_nOrdinal; // Ordinal number of this paragraph
+ LwpObjectID m_ParaStyle; // handle of paragraph style
+ LwpPoint m_Hint; // Paragraph hint - width & height
+ LwpObjectID m_Story; // Story the paragraph is part of
+
+ sal_uInt16 m_nFlags;
+ sal_uInt16 m_nLevel;
+ LwpFribPtr m_Fribs;
+ std::vector< std::unique_ptr<LwpParaProperty> > m_vProps;
+ //LwpForked3NotifyList* m_NotifyList; //not saved
+
+ OUString m_StyleName;
+ OUString m_ParentStyleName;//Add to support toc
+ std::unique_ptr<LwpBreaksOverride> m_pBreaks;
+ OUString m_AftPageBreakName;
+ OUString m_BefPageBreakName;
+ OUString m_AftColumnBreakName;
+
+ OUString m_BefColumnBreakName;
+ std::unique_ptr<LwpIndentOverride> m_pIndentOverride;
+ OUString m_Content;//for silver bullet,get text of first frib
+ sal_uInt32 m_FontID;//for silver bullet
+ OUString m_AllText;//get all text in this paragraph
+
+ bool m_bHasBullet;
+ LwpObjectID m_aSilverBulletID;
+ LwpSilverBullet* m_pSilverBullet;
+ std::unique_ptr<LwpBulletOverride> m_xBullOver;
+ std::unique_ptr<LwpNumberingOverride> m_xParaNumbering;
+ OUString m_aBulletStyleName;
+ bool m_bBullContinue;
+ //end add
+
+ OUString m_SectionStyleName;
+ bool m_bHasDropcap;
+ sal_uInt16 m_nLines;
+ sal_uInt32 m_nChars;
+ LwpDropcapLayout* m_pDropcapLayout;
+ double m_BelowSpacing;
+
+ rtl::Reference<XFContentContainer> m_xXFContainer; //Current container for VO_PARA
+
+ enum
+ {
+ /* bit definitions for the paragraph object flags */
+ DEMAND_LOAD = 0x0001, // need to demand load this para
+ DATA_DIRTY = 0x0002, // paragraph data is dirty
+ SPELLSTARTOVER = 0x0004, // need to recheck paragraph
+ SPELLDIRTY = 0x0008, // has misspelled word in para
+ SPELLCHECKING = 0x0010, // started checking paragraph
+ READING = 0x0020, // We're loading this para from disk
+ DISKCHANGED = 0x0040, // Read size different from write size
+ USEFLOWBREAKS = 0x0080, // Use line breaks provided by filter
+ VALID_LEVEL = 0x0100, // cLevel is valid
+ NOUSECOUNT = 0x0200, // Don't change the style's use count
+ CHANGED = 0x0400, // This para has been edited
+ SPREADBULLET = 0x0800, // Para's bullet is in edit-on-page mode
+ NEWBULLET = 0x1000, // Bullets should have new font behavior
+
+ // Don't write these flags out to disk
+ NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
+
+ MAX_INDENT_LEVELS = 10
+ };
+private:
+ virtual ~LwpPara() override;
+
+ static void OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle);
+ void OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle);
+ void OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle);
+ void OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
+ void OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
+
+ void OverrideParaBullet(LwpParaProperty* pProps);
+ void OverrideParaNumbering(LwpParaProperty const * pProps);
+
+ void RegisterMasterPage(XFParaStyle const * pBaseStyle);
+ void RegisterNewSectionStyle(LwpPageLayout* pLayout);
+
+ void ParseDropcapContent();
+ rtl::Reference<XFContentContainer> AddBulletList(XFContentContainer* pCont);
+ void AddBreakAfter(XFContentContainer* pCont);
+ void AddBreakBefore(XFContentContainer* pCont);
+ rtl::Reference<XFSection> CreateXFSection();
+
+ void ReadPropertyList(LwpObjectStream* pFile);
+};
+
+inline LwpSilverBullet* LwpPara::GetSilverBullet()
+{
+ return m_pSilverBullet;
+}
+inline const OUString& LwpPara::GetBulletChar() const
+{
+ return m_Content;
+}
+inline sal_uInt32 LwpPara::GetBulletFontID() const
+{
+ return m_FontID;
+}
+inline sal_uInt16 LwpPara::GetLevel() const
+{
+ return m_nLevel;
+}
+inline void LwpPara::SetBulletFlag(bool bFlag)
+{
+ m_bHasBullet = bFlag;
+}
+inline bool LwpPara::GetBulletFlag() const
+{
+ return m_bHasBullet;
+}
+inline LwpFribPtr& LwpPara::GetFribs()
+{
+ return m_Fribs;
+}
+inline XFContentContainer* LwpPara::GetXFContainer()
+{
+ return m_xXFContainer.get();
+}
+inline const OUString& LwpPara::GetBulletStyleName() const
+{
+ return m_aBulletStyleName;
+}
+inline void LwpPara::AddXFContent(XFContent* pCont)
+{
+ if (!m_xXFContainer)
+ throw std::runtime_error("paragraph lacks container");
+ m_xXFContainer->Add(pCont);
+}
+inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
+{
+ m_xXFContainer.set(pCont);
+}
+inline LwpIndentOverride* LwpPara::GetIndent()
+{
+ return m_pIndentOverride.get();
+}
+inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
+{
+ m_pIndentOverride.reset( pIndentOverride );
+}
+inline LwpObjectID& LwpPara::GetStoryID()
+{
+ return m_Story;
+}
+inline LwpStory* LwpPara::GetStory()
+{
+ if (m_Story.obj().is())
+ return dynamic_cast<LwpStory*>(m_Story.obj().get());
+ return nullptr;
+}
+inline void LwpPara::SetParaDropcap(bool bFlag)
+{
+ m_bHasDropcap = bFlag;
+}
+inline void LwpPara::SetDropcapLayout(LwpDropcapLayout* pLayout)
+{
+ m_pDropcapLayout = pLayout;
+}
+inline double LwpPara::GetBelowSpacing() const
+{
+ return m_BelowSpacing;
+}
+inline void LwpPara::SetBelowSpacing(double value)
+{
+ m_BelowSpacing = value;
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx
new file mode 100644
index 000000000..a6901bf9b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppara1.cxx
@@ -0,0 +1,602 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+
+#include <boost/cast.hpp>
+
+#include "lwppara.hxx"
+#include <lwpglobalmgr.hxx>
+#include <lwpfilehdr.hxx>
+#include "lwpparaproperty.hxx"
+#include <lwptools.hxx>
+#include "lwpparastyle.hxx"
+#include <xfilter/xffont.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/xfmargins.hxx>
+#include <xfilter/xftabstop.hxx>
+#include <xfilter/xflinebreak.hxx>
+#include <xfilter/xfsection.hxx>
+#include <xfilter/xfsectionstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfhyperlink.hxx>
+#include "lwpcharsetmgr.hxx"
+#include "lwpfribheader.hxx"
+#include "lwpsection.hxx"
+#include "lwplayout.hxx"
+#include "lwpusewhen.hxx"
+
+#include "lwpbulletstylemgr.hxx"
+#include "lwpstory.hxx"
+#include "lwpsilverbullet.hxx"
+#include <xfilter/xflist.hxx>
+#include <xfilter/xfframe.hxx>
+
+#include "lwpdivinfo.hxx"
+#include "lwpdoc.hxx"
+#include "lwpholder.hxx"
+#include "lwppagehint.hxx"
+
+#include <lwpdropcapmgr.hxx>
+#include "lwptable.hxx"
+#include "lwpcelllayout.hxx"
+#include "lwpframelayout.hxx"
+
+#include <o3tl/sorted_vector.hxx>
+
+// boost::polymorphic_downcast checks and reports (using assert), if the
+// cast is incorrect (in debug builds).
+using boost::polymorphic_downcast;
+
+/**
+ * @short get text of paragraph
+ */
+OUString const & LwpPara::GetContentText(bool bAllText)
+{
+// rFont = m_FontID;
+ if (bAllText)
+ {
+ m_Fribs.SetPara(this);
+ m_Fribs.GatherAllText();
+ return m_AllText;
+ }
+ else
+ return m_Content;
+}
+
+/**
+ * @short set text of paragraph
+ */
+void LwpPara::SetAllText(const OUString& sText)
+{
+ m_AllText+=sText;
+}
+
+/**
+ * @short set first frib content
+ */
+void LwpPara::SetFirstFrib(const OUString& Content,sal_uInt32 FontID)
+{
+ m_FontID= FontID;
+ m_Content=Content;
+}
+/**
+ * @short get paragraph xfstyle
+ */
+XFParaStyle* LwpPara::GetXFParaStyle()
+{
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ return pXFStyleManager->FindParaStyle(m_StyleName);
+}
+/**
+ * @short get drop cap info
+ */
+void LwpPara::GatherDropcapInfo()
+{
+ m_nLines = m_pDropcapLayout->GetLines();
+ m_nChars = m_pDropcapLayout->GetChars();
+}
+/**
+ * @short get parent paragraph
+ */
+LwpPara* LwpPara::GetParent()
+{
+ LwpPara* pPara;
+ sal_uInt16 otherlevel;
+ sal_uInt16 level = GetLevel();
+
+ if (level != 1)
+ {
+ pPara = dynamic_cast<LwpPara*>(GetPrevious().obj().get());
+ o3tl::sorted_vector<LwpPara*> aSeen;
+ while (pPara)
+ {
+ aSeen.insert(pPara);
+ otherlevel = pPara->GetLevel();
+ if ((otherlevel < level) || (otherlevel && (level == 0)))
+ return pPara;
+ pPara = dynamic_cast<LwpPara*>(pPara->GetPrevious().obj().get());
+ if (aSeen.find(pPara) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ }
+ return nullptr;
+}
+
+/**
+ * @short: Offer prefix, paranumber and suffix according to position.
+ * @param: nPosition index of wanted paranumbering in the style-list.
+ * @param: pParaNumbering a pointer to the structure which contains prefix, paranumber and
+ * suffix.
+ */
+void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
+{
+ if (nPosition > 9)
+ {
+ return;
+ }
+ sal_uInt16 nCurrentPos = 0;
+
+ LwpFrib* pPreFrib = nullptr;
+ LwpFrib* pFrib = m_Fribs.GetFribs();
+ if (!pFrib)
+ {
+ return;
+ }
+
+ while (pFrib)
+ {
+ sal_uInt8 nFribType = pFrib->GetType();
+ if (nFribType == FRIB_TAG_PARANUMBER)
+ {
+ nCurrentPos++;
+ ModifierInfo* pModInfo = pFrib->GetModifiers();
+ if (pModInfo)
+ {
+ sal_uInt16 nHideLevels = pModInfo->aTxtAttrOverride.GetHideLevels();
+ if (nCurrentPos == nPosition)
+ {
+ //get prefix text frib
+ if (pPreFrib)
+ {
+ if ((pPreFrib->GetType() == FRIB_TAG_TEXT) &&
+ (pPreFrib->GetModifiers() && pPreFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
+ {
+ pParaNumbering->pPrefix = static_cast<LwpFribText*>(pPreFrib);
+ }
+ }
+
+ //get para numbering
+ pParaNumbering->pParaNumber = static_cast<LwpFribParaNumber*>(pFrib);
+ pParaNumbering->nNumLevel = nHideLevels;
+
+ //get suffix text frib
+ pFrib = pFrib->GetNext();
+ if ( pFrib )
+ {
+ if( pFrib->GetType() == FRIB_TAG_TEXT )
+ {
+ if (
+ (pFrib->GetNext() && pFrib->GetNext()->GetType() == FRIB_TAG_TEXT) ||
+ (pFrib->GetModifiers() && pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels)
+ )
+ {
+ pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib);
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ else
+ {
+ if (nCurrentPos == nPosition)
+ {
+ //get prefix text frib
+ if (pPreFrib)
+ {
+ if (pPreFrib->GetType() == FRIB_TAG_TEXT)
+ {
+ pParaNumbering->pPrefix = static_cast<LwpFribText*>(pPreFrib);
+ }
+ }
+
+ //get para numbering
+ pParaNumbering->pParaNumber = static_cast<LwpFribParaNumber*>(pFrib);
+
+ //get suffix text frib
+ pFrib = pFrib->GetNext();
+ if ( pFrib )
+ {
+ if (pFrib->GetType() == FRIB_TAG_TEXT)
+ {
+ pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib);
+ }
+ }
+
+ }
+ }
+ }
+ pPreFrib = pFrib;
+ if (pFrib)
+ {
+ pFrib = pFrib->GetNext();
+ }
+ }
+}
+/**
+ * @short override alignment
+ */
+void LwpPara::OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle)
+{
+ if (base)//the latter two parameter never be null
+ {
+ over->Override(base);
+ LwpParaStyle::ApplyAlignment(pOverStyle,base);
+ }
+ else
+ LwpParaStyle::ApplyAlignment(pOverStyle,over);
+}
+/**
+ * @short override indent attribute
+ */
+void LwpPara::OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle)
+{
+ if (base)//the latter two parameter never be null
+ {
+ over->Override(base);
+ LwpParaStyle::ApplyIndent(this,pOverStyle,base);
+ }
+ else
+ {
+ LwpParaStyle::ApplyIndent(this,pOverStyle,over);
+ }
+}
+/**
+ * @short override spacing
+ */
+void LwpPara::OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle)
+{
+ if (base)//the latter two parameter never be null
+ {
+ if (over)
+ over->Override(base);
+ LwpParaStyle::ApplySpacing(this,pOverStyle,base);
+ }
+ else
+ LwpParaStyle::ApplySpacing(this,pOverStyle,over);
+}
+
+/**
+ * @short: Get parastyle object according to the objID.
+ * @return: pointer to the parastyle.
+ */
+LwpParaStyle* LwpPara::GetParaStyle()
+{
+ return dynamic_cast<LwpParaStyle*>(m_ParaStyle.obj(VO_PARASTYLE).get());
+}
+
+/**
+ * @short: Override paraborder style.
+ * @param: pProps pointer to the LwpParaProperty and we can get local breaks through it.
+ * @param: pOverStyle pointer to XFParaStyle which contains the parastyle for XFilter.
+ */
+void LwpPara::OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle)
+{
+ // get paraborder in parastyle
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ if (!pParaStyle)
+ {
+ return;
+ }
+
+ LwpOverride* pBorder = pParaStyle->GetParaBorder();
+ std::unique_ptr<LwpParaBorderOverride> pFinalBorder(
+ pBorder
+ ? polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone())
+ : new LwpParaBorderOverride)
+ ;
+
+ // get local border
+ pBorder = static_cast<LwpParaBorderProperty*>(pProps)->GetLocalParaBorder();
+ if (pBorder)
+ {
+ std::unique_ptr<LwpParaBorderOverride> pLocalBorder(
+ polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone()));
+ pLocalBorder->Override(pFinalBorder.get());
+ }
+
+ LwpParaStyle::ApplyParaBorder(pOverStyle, pFinalBorder.get());
+}
+/**
+ * @short: Override parabreaks style.
+ * @param: pProps pointer to the LwpParaProperty and we can get local breaks through it.
+ * @param: pOverStyle pointer to XFParaStyle which contains the parastyle for XFilter.
+ */
+void LwpPara::OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle)
+{
+ // get breaks in parastyle
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ if (!pParaStyle)
+ {
+ return;
+ }
+
+ LwpOverride* pBreaks = pParaStyle->GetBreaks();
+ std::unique_ptr<LwpBreaksOverride> pFinalBreaks(
+ pBreaks
+ ? polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone())
+ : new LwpBreaksOverride)
+ ;
+
+ // get local breaks
+ pBreaks = static_cast<LwpParaBreaksProperty*>(pProps)->GetLocalParaBreaks();
+ if (pBreaks)
+ {
+ std::unique_ptr<LwpBreaksOverride> const pLocalBreaks(
+ polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone()));
+ pLocalBreaks->Override(pFinalBreaks.get());
+ }
+
+ // save the breaks
+ m_pBreaks.reset( pFinalBreaks.release() );
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ if (m_pBreaks->IsKeepWithNext())
+ {
+ pOverStyle->SetBreaks(enumXFBreakKeepWithNext);
+ }
+ if (m_pBreaks->IsPageBreakBefore())
+ {
+ std::unique_ptr<XFParaStyle> pStyle(new XFParaStyle());
+ pStyle->SetBreaks(enumXFBreakAftPage);
+ m_BefPageBreakName = pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+ }
+ if (m_pBreaks->IsPageBreakAfter())
+ {
+ std::unique_ptr<XFParaStyle> pStyle(new XFParaStyle());
+ pStyle->SetBreaks(enumXFBreakAftPage);
+ m_AftPageBreakName = pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+ }
+ if (m_pBreaks->IsColumnBreakBefore())
+ {
+ std::unique_ptr<XFParaStyle> pStyle(new XFParaStyle());
+ pStyle->SetBreaks(enumXFBreakAftColumn);//tmp after, should change when layout read
+ m_BefColumnBreakName = pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+ }
+ if (m_pBreaks->IsColumnBreakAfter())
+ {
+ std::unique_ptr<XFParaStyle> pStyle(new XFParaStyle());
+ pStyle->SetBreaks(enumXFBreakAftColumn);
+ m_AftColumnBreakName = pXFStyleManager->AddStyle(std::move(pStyle)).m_pStyle->GetStyleName();
+ }
+
+// pParaStyle->ApplyBreaks(pOverStyle, &aFinalBreaks);
+}
+
+/**
+ * @short: Override bullet styles.
+ * @param: pProps pointer to the LwpParaProperty and we can get local bullet through it.
+ */
+void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
+{
+ // get bulletoverride in parastyle
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ if (!pParaStyle)
+ {
+ return;
+ }
+
+ if (pProps)
+ {
+ m_xBullOver.reset(new LwpBulletOverride);
+ // get local bulletoverride
+ LwpBulletOverride* pLocalBullet = static_cast<LwpParaBulletProperty*>(pProps)->GetLocalParaBullet();
+ if (!pLocalBullet)
+ {
+ return;
+ }
+
+ LwpObjectID aSilverBulletID = pLocalBullet->GetSilverBullet();
+ if (aSilverBulletID.IsNull())
+ {
+ return;
+ }
+ else
+ {
+ m_bHasBullet = true;
+
+ const LwpBulletOverride& rBullet= pParaStyle->GetBulletOverride();
+ std::unique_ptr<LwpBulletOverride> xFinalBullet(rBullet.clone());
+
+ std::unique_ptr<LwpBulletOverride> const pLocalBullet2(pLocalBullet->clone());
+ pLocalBullet2->Override(xFinalBullet.get());
+
+ aSilverBulletID = xFinalBullet->GetSilverBullet();
+ m_xBullOver = std::move(xFinalBullet);
+ if (!aSilverBulletID.IsNull())
+ {
+ m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(aSilverBulletID.obj(VO_SILVERBULLET).get());
+ if (m_pSilverBullet)
+ m_pSilverBullet->SetFoundry(m_pFoundry);
+ }
+
+ m_aSilverBulletID = aSilverBulletID;
+ }
+ }
+ else
+ {
+ const LwpBulletOverride& rBullOver = pParaStyle->GetBulletOverride();
+ m_aSilverBulletID = rBullOver.GetSilverBullet();
+ if (!m_aSilverBulletID.IsNull())
+ {
+ m_bHasBullet = true;
+
+ m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(m_aSilverBulletID.obj(VO_SILVERBULLET).get());
+ if (m_pSilverBullet)
+ m_pSilverBullet->SetFoundry(m_pFoundry);
+ }
+
+ m_xBullOver.reset(rBullOver.clone());
+ }
+}
+/**
+ * @short: Override paranumbering properties.
+ * @param: pProps pointer to the LwpParaProperty and we can get local paranumbering through it.
+ */
+void LwpPara::OverrideParaNumbering(LwpParaProperty const * pProps)
+{
+ // get numbering override in parastyle
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ if (!pParaStyle)
+ {
+ return;
+ }
+
+ LwpNumberingOverride* pParaNumbering = pParaStyle->GetNumberingOverride();
+ std::unique_ptr<LwpNumberingOverride> pOver(new LwpNumberingOverride);
+ //Override with the local numbering, if any
+ if (pProps)
+ {
+ LwpNumberingOverride* pPropNumbering = static_cast<LwpParaNumberingProperty const *>(pProps)->GetLocalNumbering();
+ if (pPropNumbering)
+ {
+ pOver.reset(pPropNumbering->clone());
+ }
+ }
+ else
+ {
+ if (pParaNumbering)
+ {
+ pOver.reset(pParaNumbering->clone());
+ }
+ }
+
+ if (m_nFlags & VALID_LEVEL)
+ {
+ pOver->OverrideLevel(m_nLevel);
+ }
+
+ m_xParaNumbering = std::move(pOver);
+}
+
+/**************************************************************************
+ * @descr: Get property according to the property type
+**************************************************************************/
+LwpParaProperty* LwpPara::GetProperty(sal_uInt32 nPropType)
+{
+ for (auto & i : m_vProps)
+ if(i->GetType() == nPropType)
+ {
+ return i.get();
+ }
+ return nullptr;
+}
+
+/**************************************************************************
+ * @descr: Get local tab rack
+**************************************************************************/
+LwpTabOverride* LwpPara::GetLocalTabOverride()
+{
+ LwpParaProperty* pProp = GetProperty(PP_LOCAL_TABRACK);
+ if(pProp)
+ {
+ return static_cast<LwpParaTabRackProperty*>(pProp)->GetTab();
+ }
+ return nullptr;
+}
+
+/**
+* @descr: Determined which para is earlier in position
+*
+*/
+bool LwpPara::operator< (LwpPara const & Other)
+{
+ return m_nOrdinal < Other.m_nOrdinal;
+}
+
+/**
+* @descr: If the two layouts in the same para, compare which layout is earlied according to frib order
+*
+*/
+bool LwpPara::ComparePagePosition(LwpVirtualLayout const * pPreLayout, LwpVirtualLayout const * pNextLayout)
+{
+ m_Fribs.SetPara(this);
+ return m_Fribs.ComparePagePosition(pPreLayout, pNextLayout);
+}
+
+/**
+ * @short check paragraph in cell or not
+ */
+bool LwpPara::IsInCell()
+{
+ LwpStory *pStory = GetStory();
+ if (!pStory)
+ return false;
+ rtl::Reference<LwpVirtualLayout> xLayout(pStory->GetLayout(nullptr));
+ return xLayout.is() && xLayout->IsCell();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.cxx b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
new file mode 100644
index 000000000..4d372ae5b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
@@ -0,0 +1,389 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Border override of Wordpro.
+************************************************************************/
+#include <memory>
+
+#include "clone.hxx"
+#include "lwpparaborderoverride.hxx"
+#include "lwpborderstuff.hxx"
+#include "lwpshadow.hxx"
+#include "lwpmargins.hxx"
+#include <sal/log.hxx>
+
+LwpParaBorderOverride::LwpParaBorderOverride()
+{
+ m_pBorderStuff.reset( new LwpBorderStuff() );
+ m_pBetweenStuff.reset( new LwpBorderStuff() );
+ m_pShadow.reset( new LwpShadow() );
+ m_pMargins.reset( new LwpMargins() );
+
+ m_eAboveType = PB_NONE;
+ m_eBelowType = PB_NONE;
+ m_eRightType = PB_NONE;
+ m_eBetweenType = PB_NONE;
+
+ m_nAboveWidth = 0;
+ m_nBelowWidth = 0;
+ m_nBetweenWidth = 0;
+ m_nRightWidth = 0;
+
+ m_nBetweenMargin = 0;
+}
+
+LwpParaBorderOverride::LwpParaBorderOverride(LwpParaBorderOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_eAboveType(rOther.m_eAboveType)
+ , m_eBelowType(rOther.m_eBelowType)
+ , m_eRightType(rOther.m_eRightType)
+ , m_eBetweenType(rOther.m_eBetweenType)
+ , m_nAboveWidth(rOther.m_nAboveWidth)
+ , m_nBelowWidth(rOther.m_nBelowWidth)
+ , m_nBetweenWidth(rOther.m_nBetweenWidth)
+ , m_nRightWidth(rOther.m_nRightWidth)
+ , m_nBetweenMargin(rOther.m_nBetweenMargin)
+{
+ m_pBorderStuff.reset( ::clone(rOther.m_pBorderStuff.get()) );
+ m_pBetweenStuff.reset( ::clone(rOther.m_pBetweenStuff.get()) );
+ m_pShadow.reset( ::clone(rOther.m_pShadow.get()) );
+ m_pMargins.reset( ::clone(rOther.m_pMargins.get()) );
+}
+
+LwpParaBorderOverride::~LwpParaBorderOverride()
+{
+}
+
+LwpParaBorderOverride* LwpParaBorderOverride::clone() const
+{
+ return new LwpParaBorderOverride(*this);
+}
+
+namespace {
+
+LwpParaBorderOverride::BorderWidthType readBorderWidthType(
+ LwpObjectStream * stream)
+{
+ sal_uInt16 n = stream->QuickReaduInt16();
+ if (n > LwpParaBorderOverride::PB_CUSTOMWIDTH) {
+ SAL_WARN("lwp", "bad BorderWidthType " << n);
+ n = LwpParaBorderOverride::PB_NONE;
+ }
+ return static_cast<LwpParaBorderOverride::BorderWidthType>(n);
+}
+
+}
+
+void LwpParaBorderOverride::Read(LwpObjectStream *pStrm)
+{
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ //start here:
+ m_pBorderStuff->Read(pStrm);
+ m_pShadow->Read(pStrm);
+ m_pMargins->Read(pStrm);
+
+ m_eAboveType = readBorderWidthType(pStrm);
+ m_eBelowType = readBorderWidthType(pStrm);
+ m_eRightType = readBorderWidthType(pStrm);
+
+ if( pStrm->CheckExtra() )
+ {
+ m_pBetweenStuff->Read(pStrm);
+
+ m_eBetweenType = readBorderWidthType(pStrm);
+ m_nBetweenWidth = pStrm->QuickReaduInt32();
+ m_nBetweenMargin = pStrm->QuickReaduInt32();
+
+ if( pStrm->CheckExtra() )
+ {
+ m_eRightType = static_cast<BorderWidthType>(pStrm->QuickReaduInt16());
+ m_nRightWidth = pStrm->QuickReaduInt32();
+ }
+ }
+ }
+
+ pStrm->SkipExtra();
+}
+
+void LwpParaBorderOverride::Override(LwpParaBorderOverride* pOther)
+{
+ if (m_nApply & PBO_STUFF)
+ {
+ if (IsBorderStuffOverridden())
+ {
+ pOther->OverrideBorderStuff(m_pBorderStuff.get());
+ }
+ else
+ {
+ pOther->RevertBorderStuff();
+ }
+ }
+
+ if (m_nApply & PBO_BETWEENSTUFF)
+ {
+ if (IsBetweenStuffOverridden())
+ {
+ pOther->OverrideBetweenStuff(m_pBetweenStuff.get());
+ }
+ else
+ {
+ pOther->RevertBetweenStuff();
+ }
+ }
+
+ if (m_nApply & PBO_SHADOW)
+ {
+ if (IsShadowOverridden())
+ {
+ pOther->OverrideShadow(m_pShadow.get());
+ }
+ else
+ {
+ pOther->RevertShadow();
+ }
+ }
+
+ if (m_nApply & PBO_MARGINS)
+ {
+ if (IsMarginsOverridden())
+ {
+ pOther->OverrideMargins(m_pMargins.get());
+ }
+ else
+ {
+ pOther->RevertMargins();
+ }
+ }
+
+ if (m_nApply & PBO_ABOVETYPE)
+ {
+ if (IsAboveTypeOverridden())
+ {
+ pOther->OverrideAboveType(m_eAboveType);
+ }
+ else
+ {
+ pOther->RevertAboveType();
+ }
+ }
+
+ if (m_nApply & PBO_BELOWTYPE)
+ {
+ if (IsBelowTypeOverridden())
+ {
+ pOther->OverrideBelowType(m_eBelowType);
+ }
+ else
+ {
+ pOther->RevertBelowType();
+ }
+ }
+
+ if (m_nApply & PBO_RIGHTTYPE)
+ {
+ if (IsRightTypeOverridden())
+ {
+ pOther->OverrideRightType(m_eRightType);
+ }
+ else
+ {
+ pOther->RevertRightType();
+ }
+ }
+
+ if (m_nApply & PBO_BETWEENTYPE)
+ {
+ if (IsBetweenTypeOverridden())
+ {
+ pOther->OverrideBetweenType(m_eBetweenType);
+ }
+ else
+ {
+ pOther->RevertBetweenType();
+ }
+ }
+
+ if (m_nApply & PBO_ABOVE)
+ {
+ if (IsAboveWidthOverridden())
+ {
+ pOther->OverrideAboveWidth(m_nAboveWidth);
+ }
+ else
+ {
+ pOther->RevertAboveWidth();
+ }
+ }
+
+ if (m_nApply & PBO_BELOW)
+ {
+ if (IsBelowWidthOverridden())
+ {
+ pOther->OverrideBelowWidth(m_nBelowWidth);
+ }
+ else
+ {
+ pOther->RevertBelowWidth();
+ }
+ }
+
+ if (m_nApply & PBO_BETWEEN)
+ {
+ if (IsBetweenWidthOverridden())
+ {
+ pOther->OverrideBetweenWidth(m_nBetweenWidth);
+ }
+ else
+ {
+ pOther->RevertBetweenWidth();
+ }
+ }
+
+ if (m_nApply & PBO_BETWEENMARGIN)
+ {
+ if (IsBetweenMarginOverridden())
+ {
+ pOther->OverrideBetweenMargin(m_nBetweenMargin);
+ }
+ else
+ {
+ pOther->RevertBetweenMargin();
+ }
+ }
+
+ if (m_nApply & PBO_RIGHT)
+ {
+ if (IsRightWidthOverridden())
+ {
+ pOther->OverrideRightWidth(m_nRightWidth);
+ }
+ else
+ {
+ pOther->RevertRightWidth();
+ }
+ }
+}
+
+void LwpParaBorderOverride::OverrideBorderStuff(LwpBorderStuff const * pBorderStuff)
+{
+ *m_pBorderStuff = *pBorderStuff;
+ LwpOverride::Override(PBO_STUFF, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideBetweenStuff(LwpBorderStuff const * pBorderStuff)
+{
+ *m_pBetweenStuff = *pBorderStuff;
+ LwpOverride::Override(PBO_BETWEENSTUFF, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideShadow(LwpShadow const * pShadow)
+{
+ *m_pShadow = *pShadow;
+ LwpOverride::Override(PBO_SHADOW, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideMargins(LwpMargins const * pMargins)
+{
+ *m_pMargins = *pMargins;
+ LwpOverride::Override(PBO_MARGINS, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideAboveType(BorderWidthType eNewType)
+{
+ m_eAboveType = eNewType;
+ LwpOverride::Override(PBO_ABOVETYPE, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideBelowType(BorderWidthType eNewType)
+{
+ m_eBelowType = eNewType;
+ LwpOverride::Override(PBO_BELOWTYPE, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideRightType(BorderWidthType eNewType)
+{
+ m_eRightType = eNewType;
+ LwpOverride::Override(PBO_RIGHTTYPE, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideBetweenType(BorderWidthType eNewType)
+{
+ m_eBetweenType = eNewType;
+ LwpOverride::Override(PBO_BETWEENTYPE, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideAboveWidth(sal_uInt32 nNewWidth)
+{
+ m_nAboveWidth = nNewWidth;
+ LwpOverride::Override(PBO_ABOVE, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideBelowWidth(sal_uInt32 nNewWidth)
+{
+ m_nBelowWidth = nNewWidth;
+ LwpOverride::Override(PBO_BELOW, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideBetweenWidth(sal_uInt32 nNewWidth)
+{
+ m_nBetweenWidth = nNewWidth;
+ LwpOverride::Override(PBO_BETWEEN, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideRightWidth(sal_uInt32 nNewWidth)
+{
+ m_nRightWidth = nNewWidth;
+ LwpOverride::Override(PBO_RIGHT, STATE_ON);
+}
+void LwpParaBorderOverride::OverrideBetweenMargin(sal_uInt32 nNewMargin)
+{
+ m_nBetweenMargin = nNewMargin;
+ LwpOverride::Override(PBO_BETWEENMARGIN, STATE_ON);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.hxx b/lotuswordpro/source/filter/lwpparaborderoverride.hxx
new file mode 100644
index 000000000..cb711052c
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.hxx
@@ -0,0 +1,283 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+* @file
+* Border override of Wordpro.
+************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARABORDEROVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARABORDEROVERRIDE_HXX
+
+#include <lwpoverride.hxx>
+
+class LwpBorderStuff;
+class LwpShadow;
+class LwpMargins;
+
+class LwpParaBorderOverride final : public LwpOverride
+{
+public:
+ LwpParaBorderOverride();
+ virtual ~LwpParaBorderOverride() override;
+
+ virtual LwpParaBorderOverride* clone() const override;
+
+ enum BorderWidthType
+ {
+ PB_NONE = 0, /* No border */
+ PB_TEXTWIDTH = 1, /* Border is width of text */
+ PB_MARGINWIDTH = 2, /* Border extends to margins */
+ PB_CUSTOMWIDTH = 3 /* Border width is specified explicitly */
+ };
+ virtual void Read(LwpObjectStream *pStrm) override;
+
+ LwpShadow* GetShadow(){ return m_pShadow.get(); }
+ LwpBorderStuff* GetBorderStuff(){ return m_pBorderStuff.get(); }
+ LwpMargins* GetMargins() { return m_pMargins.get(); };
+
+ void Override(LwpParaBorderOverride* pOther);
+
+ inline bool IsBorderStuffOverridden() const;
+ inline bool IsBetweenStuffOverridden() const;
+ inline bool IsShadowOverridden() const;
+ inline bool IsMarginsOverridden() const;
+ inline bool IsAboveTypeOverridden() const;
+ inline bool IsBelowTypeOverridden() const;
+ inline bool IsRightTypeOverridden() const;
+ inline bool IsBetweenTypeOverridden() const;
+ inline bool IsAboveWidthOverridden() const;
+ inline bool IsBelowWidthOverridden() const;
+ inline bool IsBetweenWidthOverridden() const;
+ inline bool IsRightWidthOverridden() const;
+ inline bool IsBetweenMarginOverridden() const;
+
+ void OverrideBorderStuff(LwpBorderStuff const * pBorderStuff);
+ void OverrideBetweenStuff(LwpBorderStuff const * pBorderStuff);
+ void OverrideShadow(LwpShadow const * pShadow);
+ void OverrideMargins(LwpMargins const * pMargins);
+ void OverrideAboveType(BorderWidthType eNewType);
+ void OverrideBelowType(BorderWidthType eNewType);
+ void OverrideRightType(BorderWidthType eNewType);
+ void OverrideBetweenType(BorderWidthType eNewType);
+ void OverrideAboveWidth(sal_uInt32 nNewWidth);
+ void OverrideBelowWidth(sal_uInt32 nNewWidth);
+ void OverrideBetweenWidth(sal_uInt32 nNewWidth);
+ void OverrideRightWidth(sal_uInt32 nNewWidth);
+ void OverrideBetweenMargin(sal_uInt32 nNewMargin);
+
+ inline void RevertBorderStuff();
+ inline void RevertBetweenStuff();
+ inline void RevertShadow();
+ inline void RevertMargins();
+ inline void RevertAboveType();
+ inline void RevertBelowType();
+ inline void RevertRightType();
+ inline void RevertBetweenType();
+ inline void RevertAboveWidth();
+ inline void RevertBelowWidth();
+ inline void RevertBetweenWidth();
+ inline void RevertRightWidth();
+ inline void RevertBetweenMargin();
+
+ friend class LwpParaBorderPiece;
+
+private:
+ LwpParaBorderOverride(LwpParaBorderOverride const& rOther);
+ LwpParaBorderOverride& operator=(LwpParaBorderOverride const& rOther) = delete;
+
+ enum
+ {
+ PBO_STUFF = 0x0001,
+ PBO_SHADOW = 0x0002,
+ PBO_MARGINS = 0x0004,
+ PBO_ABOVETYPE = 0x0008,
+ PBO_BELOWTYPE = 0x0010,
+ PBO_RIGHTTYPE = 0x0020,
+ PBO_ABOVE = 0x0040,
+ PBO_BELOW = 0x0080,
+ PBO_BETWEENSTUFF = 0x0100,
+ PBO_BETWEENTYPE = 0x0200,
+ PBO_BETWEEN = 0x0400,
+ PBO_BETWEENMARGIN = 0x0800,
+ PBO_RIGHT = 0x1000
+ };
+
+ std::unique_ptr<LwpBorderStuff> m_pBorderStuff;
+ std::unique_ptr<LwpBorderStuff> m_pBetweenStuff;
+ std::unique_ptr<LwpShadow> m_pShadow;
+ std::unique_ptr<LwpMargins> m_pMargins;
+
+ BorderWidthType m_eAboveType;
+ BorderWidthType m_eBelowType;
+ BorderWidthType m_eRightType;
+ BorderWidthType m_eBetweenType;
+
+ sal_uInt32 m_nAboveWidth;
+ sal_uInt32 m_nBelowWidth;
+ sal_uInt32 m_nBetweenWidth;
+ sal_uInt32 m_nRightWidth;
+
+ sal_uInt32 m_nBetweenMargin;
+};
+
+inline bool LwpParaBorderOverride::IsBorderStuffOverridden() const
+{
+ return ((m_nOverride & PBO_STUFF) != 0);
+}
+inline bool LwpParaBorderOverride::IsBetweenStuffOverridden() const
+{
+ return ((m_nOverride & PBO_BETWEENSTUFF) != 0);
+}
+inline bool LwpParaBorderOverride::IsShadowOverridden() const
+{
+ return ((m_nOverride & PBO_SHADOW) != 0);
+}
+inline bool LwpParaBorderOverride::IsMarginsOverridden() const
+{
+ return ((m_nOverride & PBO_MARGINS) != 0);
+}
+inline bool LwpParaBorderOverride::IsAboveTypeOverridden() const
+{
+ return ((m_nOverride & PBO_ABOVETYPE) != 0);
+}
+inline bool LwpParaBorderOverride::IsBelowTypeOverridden() const
+{
+ return ((m_nOverride & PBO_BELOWTYPE) != 0);
+}
+inline bool LwpParaBorderOverride::IsRightTypeOverridden() const
+{
+ return ((m_nOverride & PBO_RIGHTTYPE) != 0);
+}
+inline bool LwpParaBorderOverride::IsBetweenTypeOverridden() const
+{
+ return ((m_nOverride & PBO_BETWEENTYPE) != 0);
+}
+inline bool LwpParaBorderOverride::IsAboveWidthOverridden() const
+{
+ return ((m_nOverride & PBO_ABOVE) != 0);
+}
+inline bool LwpParaBorderOverride::IsBelowWidthOverridden() const
+{
+ return ((m_nOverride & PBO_BELOW) != 0);
+}
+inline bool LwpParaBorderOverride::IsBetweenWidthOverridden() const
+{
+ return ((m_nOverride & PBO_BETWEEN) != 0);
+}
+inline bool LwpParaBorderOverride::IsRightWidthOverridden() const
+{
+ return ((m_nOverride & PBO_RIGHT) != 0);
+}
+inline bool LwpParaBorderOverride::IsBetweenMarginOverridden() const
+{
+ return ((m_nOverride & PBO_BETWEENMARGIN) != 0);
+}
+
+inline void LwpParaBorderOverride::RevertBorderStuff()
+{
+ LwpOverride::Override(PBO_STUFF, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertBetweenStuff()
+{
+ LwpOverride::Override(PBO_BETWEENSTUFF, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertShadow()
+{
+ LwpOverride::Override(PBO_SHADOW, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertMargins()
+{
+ LwpOverride::Override(PBO_MARGINS, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertAboveType()
+{
+ LwpOverride::Override(PBO_ABOVETYPE, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertBelowType()
+{
+ LwpOverride::Override(PBO_BELOWTYPE, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertRightType()
+{
+ LwpOverride::Override(PBO_RIGHTTYPE, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertBetweenType()
+{
+ LwpOverride::Override(PBO_BETWEENTYPE, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertAboveWidth()
+{
+ LwpOverride::Override(PBO_ABOVE, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertBelowWidth()
+{
+ LwpOverride::Override(PBO_BELOW, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertBetweenWidth()
+{
+ LwpOverride::Override(PBO_BETWEEN, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertRightWidth()
+{
+ LwpOverride::Override(PBO_RIGHT, STATE_STYLE);
+}
+inline void LwpParaBorderOverride::RevertBetweenMargin()
+{
+ LwpOverride::Override(PBO_BETWEENMARGIN, STATE_STYLE);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpparaproperty.cxx b/lotuswordpro/source/filter/lwpparaproperty.cxx
new file mode 100644
index 000000000..a60b291c1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpparaproperty.cxx
@@ -0,0 +1,269 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpparaproperty.hxx"
+#include <lwpobjtags.hxx>
+#include "lwppara.hxx"
+
+void LwpPara::ReadPropertyList(LwpObjectStream* pFile)
+{
+ LwpParaProperty* NewProp= nullptr;
+
+ for(;;)
+ {
+ bool bFailure;
+
+ sal_uInt32 tag = pFile->QuickReaduInt32(&bFailure);
+ // Keep reading properties until we hit the end tag or
+ // the stream ends
+ if (bFailure || tag == TAG_ENDSUBOBJ)
+ break;
+
+ // Get the length of this property
+ sal_uInt16 Len = pFile->QuickReaduInt16(&bFailure);
+
+ if (bFailure)
+ break;
+
+ // Create whatever kind of tag we just found
+ switch (tag)
+ {
+ case TAG_PARA_ALIGN:
+ NewProp = new LwpParaAlignProperty(pFile);
+ break;
+
+ case TAG_PARA_INDENT:
+ NewProp = new LwpParaIndentProperty(pFile);
+ break;
+
+ case TAG_PARA_SPACING:
+ NewProp = new LwpParaSpacingProperty(pFile);
+ break;
+
+ case TAG_PARA_BORDER:
+ NewProp = new LwpParaBorderProperty(pFile);
+ break;
+
+ case TAG_PARA_BACKGROUND:
+ NewProp = new LwpParaBackGroundProperty(pFile);
+ break;
+
+ case TAG_PARA_BREAKS:
+ NewProp = new LwpParaBreaksProperty(pFile);
+ break;
+
+ case TAG_PARA_BULLET:
+ NewProp = new LwpParaBulletProperty(pFile);
+ SetBulletFlag(true);
+ break;
+
+ case TAG_PARA_NUMBERING:
+ NewProp = new LwpParaNumberingProperty(pFile);
+ break;
+
+ case TAG_PARA_TAB:
+ NewProp = new LwpParaTabRackProperty(pFile);
+ break;
+
+ default:
+ pFile->SeekRel(Len);
+ NewProp = nullptr;
+ break;
+ }
+ // Stick it at the beginning of the list
+ if (NewProp)
+ {
+ m_vProps.emplace(m_vProps.begin(), NewProp);
+ }
+ }
+}
+
+LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile)
+{
+ LwpObjectID align;
+ align.ReadIndexed(pFile);
+
+ rtl::Reference<LwpAlignmentPiece> xAlignmentPiece(dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE).get()));
+ m_pAlignment = xAlignmentPiece.is() ? dynamic_cast<LwpAlignmentOverride*>(xAlignmentPiece->GetOverride()) : nullptr;
+
+}
+
+LwpParaAlignProperty::~LwpParaAlignProperty()
+{
+}
+
+sal_uInt32 LwpParaAlignProperty::GetType()
+{
+ return PP_LOCAL_ALIGN;
+}
+
+LwpParaIndentProperty::LwpParaIndentProperty(LwpObjectStream* pFile)
+{
+ m_aIndentID.ReadIndexed(pFile);
+
+ LwpIndentPiece *pIndentPiece = dynamic_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE).get());
+ m_pIndent = pIndentPiece ? dynamic_cast<LwpIndentOverride*>(pIndentPiece->GetOverride()) : nullptr;
+}
+
+LwpParaIndentProperty::~LwpParaIndentProperty()
+{
+}
+
+sal_uInt32 LwpParaIndentProperty::GetType()
+{
+ return PP_LOCAL_INDENT;
+}
+
+LwpParaSpacingProperty::LwpParaSpacingProperty(LwpObjectStream* pFile)
+{
+ LwpObjectID spacing;
+ spacing.ReadIndexed(pFile);
+
+ LwpSpacingPiece *pSpacingPiece = dynamic_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE).get());
+ m_pSpacing = pSpacingPiece ? dynamic_cast<LwpSpacingOverride*>(pSpacingPiece->GetOverride()) : nullptr;
+}
+
+LwpParaSpacingProperty::~LwpParaSpacingProperty()
+{
+}
+
+sal_uInt32 LwpParaSpacingProperty::GetType()
+{
+ return PP_LOCAL_SPACING;
+}
+
+// 01/25/2004
+LwpParaBorderProperty::LwpParaBorderProperty(LwpObjectStream* pStrm) :
+m_pParaBorderOverride(nullptr)
+{
+ LwpObjectID aParaBorder;
+ aParaBorder.ReadIndexed(pStrm);
+
+ if (!aParaBorder.IsNull())
+ {
+ LwpParaBorderPiece *pParaBorderPiece = dynamic_cast<LwpParaBorderPiece*>(aParaBorder.obj().get());
+ m_pParaBorderOverride = pParaBorderPiece ? dynamic_cast<LwpParaBorderOverride*>(pParaBorderPiece->GetOverride()) : nullptr;
+ }
+}
+
+LwpParaBreaksProperty::LwpParaBreaksProperty(LwpObjectStream* pStrm) :
+m_pBreaks(nullptr)
+{
+ LwpObjectID aBreaks;
+ aBreaks.ReadIndexed(pStrm);
+
+ if (!aBreaks.IsNull())
+ {
+ LwpBreaksPiece *pBreaksPiece = dynamic_cast<LwpBreaksPiece*>(aBreaks.obj().get());
+ m_pBreaks = pBreaksPiece ? dynamic_cast<LwpBreaksOverride*>(pBreaksPiece->GetOverride()) : nullptr;
+ }
+}
+
+LwpParaBulletProperty::LwpParaBulletProperty(LwpObjectStream* pStrm) :
+m_pBullet(new LwpBulletOverride)
+{
+ m_pBullet->Read(pStrm);
+}
+
+LwpParaBulletProperty::~LwpParaBulletProperty()
+{
+}
+
+LwpParaNumberingProperty::LwpParaNumberingProperty(LwpObjectStream * pStrm)
+ : m_pNumberingOverride(nullptr)
+{
+ LwpObjectID aNumberingPiece;
+ aNumberingPiece.ReadIndexed(pStrm);
+ if (aNumberingPiece.IsNull())
+ {
+ return;
+ }
+
+ LwpNumberingPiece *pNumberingPiece = dynamic_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE).get());
+ m_pNumberingOverride = pNumberingPiece ? dynamic_cast<LwpNumberingOverride*>(pNumberingPiece->GetOverride()) : nullptr;
+}
+
+LwpParaTabRackProperty::LwpParaTabRackProperty(LwpObjectStream* pFile)
+{
+ LwpObjectID aTabRack;
+ aTabRack.ReadIndexed(pFile);
+
+ LwpTabPiece *pTabPiece = dynamic_cast<LwpTabPiece*>(aTabRack.obj().get());
+ m_pTabOverride = pTabPiece ? dynamic_cast<LwpTabOverride*>(pTabPiece->GetOverride()) : nullptr;
+}
+
+LwpParaTabRackProperty::~LwpParaTabRackProperty()
+{
+}
+
+LwpParaBackGroundProperty::LwpParaBackGroundProperty(LwpObjectStream* pFile)
+{
+ LwpObjectID background;
+ background.ReadIndexed(pFile);
+
+ LwpBackgroundPiece *pBackgroundPiece = dynamic_cast<LwpBackgroundPiece*>(background.obj().get());
+ m_pBackground = pBackgroundPiece ? dynamic_cast<LwpBackgroundOverride*>(pBackgroundPiece->GetOverride()) : nullptr;
+}
+
+LwpParaBackGroundProperty::~LwpParaBackGroundProperty()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpparaproperty.hxx b/lotuswordpro/source/filter/lwpparaproperty.hxx
new file mode 100644
index 000000000..e4c10062d
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpparaproperty.hxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARAPROPERTY_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARAPROPERTY_HXX
+
+#include <memory>
+#include <lwpobjstrm.hxx>
+
+#include <lwpoverride.hxx>
+#include "lwpbackgroundoverride.hxx"
+#include "lwpbreaksoverride.hxx"
+#include "lwpnumberingoverride.hxx"
+#include "lwpparaborderoverride.hxx"
+#include "lwptaboverride.hxx"
+
+/* paragraph property ID's */
+#define PP_OUTLINE_SHOW 0x53484f4cUL /* "SHOW" */
+#define PP_OUTLINE_HIDE 0x48494445UL /* "HIDE" */
+#define PP_LOCAL_ALIGN 0x414c494eUL /* "ALIN" */
+#define PP_LOCAL_INDENT 0x494e444eUL /* "INDN" */
+#define PP_LOCAL_SPACING 0x5350434eUL /* "SPCN" */
+#define PP_LOCAL_TABRACK 0x54414253UL /* "TABS" */
+#define PP_LOCAL_BREAKS 0x42524b53UL /* "BRKS" */
+#define PP_LOCAL_BULLET 0x42554c4cUL /* "BULL" */
+#define PP_LOCAL_BORDER 0x424f5244UL /* "BORD" */
+#define PP_LOCAL_BACKGROUND 0x4241434bUL /* "BACK" */
+#define PP_LOCAL_NUMBERING 0x4e4d4252UL /* "NMBR" */
+#define PP_LOCAL_KINSOKU 0x4b494e53UL /* "KINS" */
+#define PP_PROPLIST 0x50524f50UL /* "PROP" */
+
+class LwpParaProperty
+{
+public:
+ LwpParaProperty(){}
+ virtual ~LwpParaProperty() {}
+ virtual sal_uInt32 GetType() = 0;
+};
+
+//align/indent/spacing
+//TO DO:border/background etc
+
+class LwpParaAlignProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaAlignProperty(LwpObjectStream* pFile);
+ virtual ~LwpParaAlignProperty() override;
+ LwpAlignmentOverride* GetAlignment();
+ sal_uInt32 GetType() override;
+
+private:
+ LwpAlignmentOverride* m_pAlignment;
+};
+
+inline LwpAlignmentOverride* LwpParaAlignProperty::GetAlignment()
+{
+ return m_pAlignment;
+}
+
+class LwpParaIndentProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaIndentProperty(LwpObjectStream* pFile);
+ virtual ~LwpParaIndentProperty() override;
+ LwpIndentOverride* GetIndent();
+ sal_uInt32 GetType() override;
+ inline const LwpObjectID& GetIndentID() const;
+
+private:
+ LwpObjectID m_aIndentID;
+ LwpIndentOverride* m_pIndent;
+};
+inline const LwpObjectID& LwpParaIndentProperty::GetIndentID() const
+{
+ return m_aIndentID;
+}
+inline LwpIndentOverride* LwpParaIndentProperty::GetIndent()
+{
+ return m_pIndent;
+}
+
+class LwpParaSpacingProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaSpacingProperty(LwpObjectStream* pFile);
+ virtual ~LwpParaSpacingProperty() override;
+ LwpSpacingOverride* GetSpacing();
+ sal_uInt32 GetType() override;
+private:
+ LwpSpacingOverride* m_pSpacing;
+
+};
+
+inline LwpSpacingOverride* LwpParaSpacingProperty::GetSpacing()
+{
+ return m_pSpacing;
+}
+
+class LwpParaBorderOverride;
+class LwpParaBorderProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaBorderProperty(LwpObjectStream* pStrm);
+
+ sal_uInt32 GetType() override { return PP_LOCAL_BORDER; }
+
+ inline LwpParaBorderOverride* GetLocalParaBorder();
+
+private:
+ LwpParaBorderOverride* m_pParaBorderOverride;
+};
+
+inline LwpParaBorderOverride* LwpParaBorderProperty::GetLocalParaBorder()
+{
+ return m_pParaBorderOverride;
+}
+
+class LwpParaBreaksProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaBreaksProperty(LwpObjectStream* pStrm);
+
+ sal_uInt32 GetType() override { return PP_LOCAL_BREAKS; }
+
+ inline LwpBreaksOverride* GetLocalParaBreaks();
+
+private:
+ LwpBreaksOverride* m_pBreaks;
+
+};
+
+inline LwpBreaksOverride* LwpParaBreaksProperty::GetLocalParaBreaks()
+{
+ return m_pBreaks;
+}
+
+class LwpParaBulletProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaBulletProperty(LwpObjectStream* pStrm);
+
+ virtual ~LwpParaBulletProperty() override;
+
+ sal_uInt32 GetType() override { return PP_LOCAL_BULLET; }
+
+ inline LwpBulletOverride* GetLocalParaBullet();
+
+private:
+ std::unique_ptr<LwpBulletOverride> m_pBullet;
+};
+
+inline LwpBulletOverride* LwpParaBulletProperty::GetLocalParaBullet()
+{
+ return m_pBullet.get();
+}
+
+class LwpParaNumberingProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaNumberingProperty(LwpObjectStream* pStrm);
+
+ sal_uInt32 GetType() override { return PP_LOCAL_NUMBERING; }
+
+ inline LwpNumberingOverride* GetLocalNumbering() const;
+private:
+ LwpNumberingOverride* m_pNumberingOverride;
+};
+
+inline LwpNumberingOverride* LwpParaNumberingProperty::GetLocalNumbering() const
+{
+ return m_pNumberingOverride;
+}
+
+class LwpParaTabRackProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaTabRackProperty(LwpObjectStream* pStrm);
+ virtual ~LwpParaTabRackProperty() override;
+ sal_uInt32 GetType() override { return PP_LOCAL_TABRACK; }
+
+ inline LwpTabOverride* GetTab();
+
+private:
+ LwpTabOverride* m_pTabOverride;
+};
+
+inline LwpTabOverride* LwpParaTabRackProperty::GetTab()
+{
+ return m_pTabOverride;
+}
+
+class LwpParaBackGroundProperty : public LwpParaProperty
+{
+public:
+ explicit LwpParaBackGroundProperty(LwpObjectStream* pFile);
+ virtual ~LwpParaBackGroundProperty() override;
+ LwpBackgroundOverride* GetBackground();
+ sal_uInt32 GetType() override;
+private:
+ LwpBackgroundOverride* m_pBackground;
+};
+
+inline LwpBackgroundOverride* LwpParaBackGroundProperty::GetBackground()
+{
+ return m_pBackground;
+}
+
+inline sal_uInt32 LwpParaBackGroundProperty::GetType()
+{
+ return PP_LOCAL_BACKGROUND;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx
new file mode 100644
index 000000000..33b6cc37c
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpparastyle.cxx
@@ -0,0 +1,748 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+
+#include "lwpparastyle.hxx"
+#include <lwpfilehdr.hxx>
+#include <lwpoverride.hxx>
+#include "lwpparaborderoverride.hxx"
+#include "lwpbreaksoverride.hxx"
+#include "lwpnumberingoverride.hxx"
+#include "lwptaboverride.hxx"
+#include "lwpbackgroundoverride.hxx"
+#include <o3tl/safeint.hxx>
+#include <xfilter/xfdefs.hxx>
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xfborders.hxx>
+#include <lwpfont.hxx>
+#include <lwpfoundry.hxx>
+#include "lwppiece.hxx"
+#include "lwpshadow.hxx"
+#include "lwpborderstuff.hxx"
+#include "lwpmargins.hxx"
+#include "lwptabrack.hxx"
+
+#include "lwpsilverbullet.hxx"
+
+LwpParaStyle::LwpParaStyle(LwpObjectHeader const & objHdr, LwpSvStream* pStrm) :
+LwpTextStyle(objHdr, pStrm)
+{
+}
+
+LwpParaStyle::~LwpParaStyle()
+{
+}
+
+void LwpParaStyle::Read()
+{
+ LwpTextStyle::Read();
+
+ if (LwpFileHeader::m_nFileRevision < 0x000B)
+ {
+ // read many overrides
+ LwpAlignmentOverride aAlignOverride;
+ aAlignOverride.Read(m_pObjStrm.get());
+
+ LwpSpacingOverride aSpacingOverride;
+ aSpacingOverride.Read(m_pObjStrm.get());
+
+ LwpIndentOverride aIndentOverride;
+ aIndentOverride.Read(m_pObjStrm.get());
+
+ LwpParaBorderOverride aPBOverride;
+ aPBOverride.Read(m_pObjStrm.get());
+
+ LwpBreaksOverride aBreaksOverride;
+ aBreaksOverride.Read(m_pObjStrm.get());
+
+ LwpNumberingOverride aNumberingOverride;
+ aNumberingOverride.Read(m_pObjStrm.get());
+
+ LwpTabOverride aTabOverride;
+ aTabOverride.Read(m_pObjStrm.get());
+
+ }
+ else
+ {
+ m_AlignmentStyle.ReadIndexed(m_pObjStrm.get());
+ m_SpacingStyle.ReadIndexed(m_pObjStrm.get());
+ m_IndentStyle.ReadIndexed(m_pObjStrm.get());
+ m_BorderStyle.ReadIndexed(m_pObjStrm.get());
+ m_BreaksStyle.ReadIndexed(m_pObjStrm.get());
+ m_NumberingStyle.ReadIndexed(m_pObjStrm.get());
+ m_TabStyle.ReadIndexed(m_pObjStrm.get());
+
+ m_KinsokuOptsOverride.Read(m_pObjStrm.get());
+ m_BulletOverride.Read(m_pObjStrm.get());
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ m_BackgroundStyle.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+
+ }
+}
+
+void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
+{
+ assert(pParaStyle);
+
+ //alignment:
+ LwpVirtualPiece *pPiece = dynamic_cast<LwpVirtualPiece*>(m_AlignmentStyle.obj().get());
+ if( pPiece )
+ {
+ LwpAlignmentOverride *pAlign = dynamic_cast<LwpAlignmentOverride*>(pPiece->GetOverride());
+ if( pAlign )
+ ApplyAlignment(pParaStyle,pAlign);
+ }
+
+ //don't known top and bottom indent now.
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_IndentStyle.obj().get());
+ if( pPiece )
+ {
+ LwpIndentOverride *pIndent = dynamic_cast<LwpIndentOverride*>(pPiece->GetOverride());
+ if( pIndent )
+ {
+ if (!m_BulletOverride.IsInValid())// for remove bullet indent in named bullet style
+ {
+ std::unique_ptr<LwpIndentOverride> pNewIndent(pIndent->clone());
+ pNewIndent->SetMFirst(0);
+ pNewIndent->SetMRest(0);
+ ApplyIndent(nullptr, pParaStyle, pNewIndent.get());
+ }
+ else
+ ApplyIndent(nullptr,pParaStyle,pIndent);
+ }
+ }
+ //shadow & borders.
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_BorderStyle.obj().get());
+ if( pPiece )
+ {
+ LwpParaBorderOverride *pBorder = dynamic_cast<LwpParaBorderOverride*>(pPiece->GetOverride());
+ if( pBorder )
+ {
+ ApplyParaBorder(pParaStyle, pBorder);
+ }
+ }
+
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_SpacingStyle.obj().get());
+ if (pPiece)
+ {
+ LwpSpacingOverride *pSpacing = dynamic_cast<LwpSpacingOverride*>(pPiece->GetOverride());
+ if( pSpacing)
+ ApplySpacing(nullptr,pParaStyle,pSpacing);
+ }
+
+ //paragraph background.
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_BackgroundStyle.obj().get());
+ if( pPiece )
+ {
+ LwpBackgroundOverride *pBack = dynamic_cast<LwpBackgroundOverride*>(pPiece->GetOverride());
+ if( pBack )
+ {
+ LwpColor color = pBack->GetBackColor();
+ XFColor aXFColor( color.To24Color() );
+ pParaStyle->SetBackColor( aXFColor );
+ }
+ }
+
+ //add tab style
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_TabStyle.obj().get());
+ if( pPiece )
+ {
+ LwpTabOverride *pTab = dynamic_cast<LwpTabOverride*>(pPiece->GetOverride());
+ if(pTab)
+ {
+ ApplyTab(pParaStyle,pTab);
+ }
+ }
+ pPiece = dynamic_cast<LwpVirtualPiece*>(m_BreaksStyle.obj().get());
+ if( pPiece )
+ {
+ LwpBreaksOverride *pBreak = dynamic_cast<LwpBreaksOverride*>(pPiece->GetOverride());
+ if(pBreak)
+ {
+ ApplyBreaks(pParaStyle,pBreak);
+ }
+ }
+
+}
+
+void LwpParaStyle::ApplySubBorder(LwpBorderStuff* pBorderStuff, LwpBorderStuff::BorderType eType, XFBorders* pXFBorders)
+{
+ enumXFBorder eXFBorderSide = enumXFBorderNone;
+ switch (eType)
+ {
+ case LwpBorderStuff::LEFT:
+ eXFBorderSide = enumXFBorderLeft;
+ break;
+ case LwpBorderStuff::RIGHT:
+ eXFBorderSide = enumXFBorderRight;
+ break;
+ case LwpBorderStuff::TOP:
+ eXFBorderSide = enumXFBorderTop;
+ break;
+ case LwpBorderStuff::BOTTOM:
+ eXFBorderSide = enumXFBorderBottom;
+ break;
+ default:
+ break;
+ }
+
+ LwpColor aColor = pBorderStuff->GetSideColor(eType);
+ float fWidth = pBorderStuff->GetSideWidth(eType);
+ sal_uInt16 nType = pBorderStuff->GetSideType(eType);
+
+ switch (nType)
+ {
+ default://fall through!
+ case 0x14: //single fall through!
+ case 0x17: //treble
+ pXFBorders->SetWidth(eXFBorderSide, fWidth);
+ break;
+ case 0x15: //double , fall through!
+ case 0x16: //thick double
+ pXFBorders->SetDoubleLine(eXFBorderSide);
+ pXFBorders->SetWidthOuter(eXFBorderSide, static_cast<float>(fWidth*0.333));
+ pXFBorders->SetWidthSpace(eXFBorderSide, static_cast<float>(fWidth*0.334));
+ pXFBorders->SetWidthInner(eXFBorderSide, static_cast<float>(fWidth*0.333));
+// pXFBorders->SetWidth(eXFBorderSide, fWidth);
+ break;
+ case 0x18: //thick-thin
+ pXFBorders->SetDoubleLine(eXFBorderSide);
+ pXFBorders->SetWidthOuter(eXFBorderSide, static_cast<float>(fWidth*0.5));
+ pXFBorders->SetWidthInner(eXFBorderSide, static_cast<float>(fWidth*0.25));
+ pXFBorders->SetWidthSpace(eXFBorderSide, static_cast<float>(fWidth*0.25));
+ break;
+ case 0x19: //thin-thick
+ pXFBorders->SetDoubleLine(eXFBorderSide);
+ pXFBorders->SetWidthInner(eXFBorderSide, static_cast<float>(fWidth*0.7));
+ pXFBorders->SetWidthOuter(eXFBorderSide, static_cast<float>(fWidth*0.15));
+ pXFBorders->SetWidthSpace(eXFBorderSide, static_cast<float>(fWidth*0.15));
+ break;
+ }
+
+ if (aColor.IsValidColor())
+ {
+ XFColor aXFColor(aColor.To24Color());
+ pXFBorders->SetColor(eXFBorderSide, aXFColor );
+ }
+}
+
+void LwpParaStyle::ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverride* pBorder)
+{
+ //convert LwpShadow:
+ LwpShadow *pShadow = pBorder->GetShadow();
+ if( pShadow )
+ {
+ LwpColor color = pShadow->GetColor();
+ float offsetX = pShadow->GetOffsetX();
+ float offsetY = pShadow->GetOffsetY();
+
+ if( offsetX && offsetY && color.IsValidColor() )
+ {
+ XFColor aXFColor(color.To24Color());
+ bool left = false;
+ bool top = false;
+ if( offsetX < 0 )
+ left = true;
+ if( offsetY < 0 )
+ top = true;
+ if( left )
+ {
+ if( top )
+ pParaStyle->SetShadow(enumXFShadowLeftTop,-offsetX,aXFColor);
+ else
+ pParaStyle->SetShadow(enumXFShadowLeftBottom,-offsetX,aXFColor);
+ }
+ else
+ {
+ if( top )
+ pParaStyle->SetShadow(enumXFShadowRightTop,offsetX,aXFColor);
+ else
+ pParaStyle->SetShadow(enumXFShadowRightBottom,offsetX,aXFColor);
+ }
+ }
+ }
+
+ //convert to XFBorders object:
+ LwpBorderStuff *pBorderStuff = pBorder->GetBorderStuff();
+ if( !(pBorderStuff && pBorderStuff->GetSide() != 0) )
+ return;
+
+ XFBorders *pXFBorders = new XFBorders();
+ pParaStyle->SetBorders(pXFBorders);
+
+ LwpMargins* pMargins = pBorder->GetMargins();
+
+ // apply 4 borders respectively
+ LwpBorderStuff::BorderType pType[] = { LwpBorderStuff::LEFT, LwpBorderStuff::RIGHT,
+ LwpBorderStuff::TOP, LwpBorderStuff::BOTTOM };
+ float pMarginValue[4] = { 0.0, 0.0, 0.0, 0.0 };
+
+ for (sal_uInt8 nC = 0; nC < 4; nC++)
+ {
+ if (pBorderStuff->HasSide(pType[nC]))
+ {
+ ApplySubBorder(pBorderStuff, pType[nC], pXFBorders);
+
+ //get border spacing to text content
+ if (pMargins)
+ {
+ pMarginValue[nC] = static_cast<float>(pMargins->GetMarginsValue(nC));
+ }
+ }
+
+ }
+
+ //apply border spacing to text content
+ pParaStyle->SetPadding(pMarginValue[0], pMarginValue[1], pMarginValue[2], pMarginValue[3]);
+}
+
+void LwpParaStyle::ApplyBreaks(XFParaStyle* pParaStyle, const LwpBreaksOverride* pBreaks)
+{
+ if (pBreaks->IsKeepWithNext())
+ {
+ pParaStyle->SetBreaks(enumXFBreakKeepWithNext);
+ }
+ if (pBreaks->IsPageBreakBefore())
+ {
+ pParaStyle->SetBreaks(enumXFBreakBefPage);
+ }
+ if (pBreaks->IsPageBreakAfter())
+ {
+ pParaStyle->SetBreaks(enumXFBreakAftPage);
+ }
+ if (pBreaks->IsColumnBreakBefore())
+ {
+ pParaStyle->SetBreaks(enumXFBreakBefColumn);
+ }
+ if (pBreaks->IsColumnBreakAfter())
+ {
+ pParaStyle->SetBreaks(enumXFBreakAftColumn);
+ }
+}
+
+void LwpParaStyle::ApplyAlignment(XFParaStyle* pParaStyle, const LwpAlignmentOverride* pAlign)
+{
+ enumXFAlignType alignType = enumXFAlignStart;
+ LwpAlignmentOverride::AlignType type;
+
+ type = pAlign->GetAlignType();
+ pParaStyle->SetNumberRight(false);//to identify its align attribute
+ switch(type)
+ {
+ case LwpAlignmentOverride::ALIGN_LEFT:
+ alignType = enumXFAlignStart;
+ break;
+ case LwpAlignmentOverride::ALIGN_RIGHT:
+ alignType = enumXFAlignEnd;
+ break;
+ case LwpAlignmentOverride::ALIGN_CENTER:
+ alignType = enumXFAlignCenter;
+ break;
+ case LwpAlignmentOverride::ALIGN_NUMERICLEFT://if non-number in table,ALIGN_NUMERICLEFT/RIGHT are useless
+ alignType = enumXFAlignStart; //note by 1/28
+ break;
+ case LwpAlignmentOverride::ALIGN_JUSTIFY:
+ case LwpAlignmentOverride::ALIGN_JUSTIFYALL:
+ alignType = enumXFAlignJustify;
+ break;
+ case LwpAlignmentOverride::ALIGN_NUMERICRIGHT:
+ pParaStyle->SetNumberRight(true);//to identify its align attribute
+ alignType = enumXFAlignEnd;
+ break;
+ default:
+ break;
+ }
+ pParaStyle->SetAlignType(alignType);
+}
+
+void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, const LwpIndentOverride* pIndent)
+{
+ LwpPara* pParentPara;
+ if (pPara)
+ pParentPara = pPara->GetParent();
+ else
+ pParentPara = nullptr;
+
+ std::unique_ptr<LwpIndentOverride> pTotalIndent(new LwpIndentOverride);
+ if (pIndent->IsUseRelative() && pParentPara)
+ {
+ LwpIndentOverride* pParentIndent = pParentPara->GetIndent();
+ if (!pParentIndent)
+ return;
+ pTotalIndent.reset(pIndent->clone());
+
+ //for bullet only
+ if (pPara && pPara->GetBulletFlag())
+ {
+ pTotalIndent->SetMAll(o3tl::saturating_add(pParentIndent->GetMAll(), pTotalIndent->GetMAll()));
+ pTotalIndent->SetMRight(o3tl::saturating_add(pParentIndent->GetMRight(), pTotalIndent->GetMRight()));
+ pParaStyle->SetMargins(LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(
+ pTotalIndent->GetMAll())), pTotalIndent->GetRight());
+ pPara->SetIndent(pTotalIndent.release());
+ return;
+ }
+ sal_uInt16 relative = pParentIndent->GetRelative();
+
+ sal_Int32 Amount = pParentIndent->GetMAll();
+
+ if (relative == LwpIndentOverride::RELATIVE_FIRST)
+ Amount = o3tl::saturating_add(Amount, pParentIndent->GetMFirst());
+ else if (relative == LwpIndentOverride::RELATIVE_REST)
+ Amount = o3tl::saturating_add(Amount, pParentIndent->GetMRest());
+ pTotalIndent->SetMAll(o3tl::saturating_add(Amount, pTotalIndent->GetMAll()));
+ pTotalIndent->SetMRight(o3tl::saturating_add(pParentIndent->GetMRight(), pTotalIndent->GetMRight()));
+
+ pParaStyle->SetIndent(pTotalIndent->GetFirst());
+ pParaStyle->SetMargins(pTotalIndent->GetLeft(), pTotalIndent->GetRight());
+ pPara->SetIndent(pTotalIndent.release());
+
+ }
+ else
+ {
+ pTotalIndent.reset(pIndent->clone());
+ if (pPara && pPara->GetBulletFlag())
+ {
+ pParaStyle->SetMargins(LwpTools::ConvertToMetric(
+ LwpTools::ConvertFromUnits(pIndent->GetMAll())), pIndent->GetRight());
+ pPara->SetIndent(pTotalIndent.release());
+ return;
+ }
+
+ pParaStyle->SetIndent(pIndent->GetFirst());
+ pParaStyle->SetMargins(pIndent->GetLeft(), pIndent->GetRight());
+ if (pPara)
+ {
+ pPara->SetIndent(pTotalIndent.release());
+ }
+ }
+}
+
+void LwpParaStyle::ApplySpacing(LwpPara* pPara, XFParaStyle* pParaStyle, LwpSpacingOverride* pSpacing)
+{
+ LwpSpacingCommonOverride* spacing = pSpacing->GetSpacing();
+ LwpSpacingCommonOverride* abovepara = pSpacing->GetAboveSpacing();
+ LwpSpacingCommonOverride* belowpara = pSpacing->GetBelowSpacing();
+
+ LwpSpacingCommonOverride::SpacingType type = spacing->GetType();
+ sal_Int32 amount = spacing->GetAmount();
+ sal_Int32 multiple = spacing->GetMultiple();
+ enumLHType xftype;
+ double height;
+
+ switch(type)
+ {
+ case LwpSpacingCommonOverride::SPACING_DYNAMIC:
+ {
+ xftype = enumLHPercent;
+ height = double(multiple)/65536L*100;
+ pParaStyle->SetLineHeight(xftype,height);
+ }
+ break;
+ case LwpSpacingCommonOverride::SPACING_LEADING:
+ {
+ xftype = enumLHSpace;
+ height = LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(amount));
+ pParaStyle->SetLineHeight(xftype,height);
+ }
+ break;
+ case LwpSpacingCommonOverride::SPACING_CUSTOM:
+ {
+ xftype = enumLHHeight;
+ height = LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(sal_Int32(float(multiple)/65536L*amount)));
+ pParaStyle->SetLineHeight(xftype,height);
+ }
+ break;
+ case LwpSpacingCommonOverride::SPACING_NONE:
+ break;
+ }
+
+//TO DO: Above Line need to be processed!!!!!!! what it means?????? 1-26
+
+ type = abovepara->GetType();
+ amount = abovepara->GetAmount();
+ multiple = abovepara->GetMultiple();
+ double above_val =-1;
+ switch(type)
+ {
+ case LwpSpacingCommonOverride::SPACING_DYNAMIC:
+ break;
+ case LwpSpacingCommonOverride::SPACING_LEADING:
+ break;
+ case LwpSpacingCommonOverride::SPACING_CUSTOM:
+ above_val = LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(sal_Int32(float(multiple)/65536L*amount)));
+ break;
+ case LwpSpacingCommonOverride::SPACING_NONE:
+ break;
+ }
+
+ type = belowpara->GetType();
+ amount = belowpara->GetAmount();
+ multiple = belowpara->GetMultiple();
+ double below_val=-1;
+ switch(type)
+ {
+ case LwpSpacingCommonOverride::SPACING_DYNAMIC:
+ break;
+ case LwpSpacingCommonOverride::SPACING_LEADING:
+ break;
+ case LwpSpacingCommonOverride::SPACING_CUSTOM:
+ below_val = LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(sal_Int32(float(multiple)/65536L*amount)));
+ break;
+ case LwpSpacingCommonOverride::SPACING_NONE:
+ break;
+ }
+
+ if (pPara)
+ {
+ if (below_val != -1)
+ pPara->SetBelowSpacing(below_val);
+ LwpPara* pPrePara = dynamic_cast<LwpPara*>(pPara->GetPrevious().obj().get());
+ if (pPrePara && above_val != -1)
+ {
+ above_val += pPrePara->GetBelowSpacing();
+
+ }
+
+ }
+ pParaStyle->SetMargins(-1,-1,above_val,below_val);
+}
+
+void LwpParaStyle::ApplyTab(XFParaStyle *pParaStyle, LwpTabOverride *pTabOverRide)
+{
+ LwpObjectID& rTabRackID = pTabOverRide->GetTabRackID();
+ if(rTabRackID.IsNull())
+ {
+ return;
+ }
+
+ LwpTabRack* pTabRack = dynamic_cast<LwpTabRack*>(rTabRackID.obj().get());
+ if(!pTabRack)
+ {
+ return;
+ }
+
+ pParaStyle->ClearTabStyles();
+ //Get margin left value
+ double dMarginLeft = pParaStyle->GetMargins().GetLeft();
+
+ sal_uInt16 nNumTabs = pTabRack->GetNumTabs();
+ for(sal_uInt16 nIndex=0; nIndex<nNumTabs; nIndex++)
+ {
+ //get tab type
+ LwpTab* pTab = pTabRack->Lookup(nIndex);
+ if(!pTab)
+ return;
+
+ enumXFTab eType = enumXFTabNone;
+ sal_uInt32 type = pTab->GetTabType();
+ switch(type)
+ {
+ case LwpTab::TT_LEFT:
+ eType = enumXFTabLeft;
+ break;
+ case LwpTab::TT_CENTER:
+ eType = enumXFTabCenter;
+ break;
+ case LwpTab::TT_RIGHT:
+ eType = enumXFTabRight;
+ break;
+ case LwpTab::TT_NUMERIC:
+ eType = enumXFTabChar;
+ break;
+ }
+
+ //get position
+ sal_uInt32 nPos = pTab->GetPosition();
+ //different feature between SODC and lwp, the tab length must minus the margin left of para.
+ double fLen = LwpTools::ConvertFromUnitsToMetric(nPos) - dMarginLeft;
+
+ //get leader type
+ sal_Unicode cLeader = 0x00;
+ auto leader= pTab->GetLeaderType();
+ switch(leader)
+ {
+ case LwpTab::TL_NONE:
+ cLeader = 0x20; //space
+ break;
+ case LwpTab::TL_HYPHEN: //'-'
+ cLeader = 0xAD;
+ break;
+ case LwpTab::TL_DOT: //'.'
+ cLeader = 0x2E;
+ break;
+ case LwpTab::TL_LINE: //'_'
+ cLeader = 0x5F;
+ break;
+ }
+
+ sal_Unicode cAlignChar = static_cast<sal_Unicode>(pTab->GetAlignChar());
+
+ pParaStyle->AddTabStyle(eType,fLen,cLeader,cAlignChar);
+ }
+
+}
+
+void LwpParaStyle::RegisterStyle()
+{
+ if (!m_pFoundry)
+ throw std::runtime_error("missing Foundry");
+
+ std::unique_ptr<XFParaStyle> xStyle(new XFParaStyle());
+
+ //Set name
+ OUString styleName = GetName().str();
+ xStyle->SetStyleName(styleName);
+
+ //Create font
+ LwpFontManager& rFontMgr = m_pFoundry->GetFontManger();
+ rtl::Reference<XFFont> pFont = rFontMgr.CreateFont(m_nFinalFontID);
+ xStyle->SetFont(pFont);
+
+ //Set other paragraph properties...
+
+ Apply(xStyle.get());
+ //Add style
+ LwpStyleManager* pStyleMgr = m_pFoundry->GetStyleManager();
+ pStyleMgr->AddStyle(GetObjectID(), std::move(xStyle));
+}
+
+LwpAlignmentOverride* LwpParaStyle::GetAlignment()
+{
+ if (m_AlignmentStyle.obj() == nullptr)
+ return nullptr;
+
+ LwpAlignmentPiece *pPiece = dynamic_cast<LwpAlignmentPiece*>(m_AlignmentStyle.obj().get());
+ if (pPiece)
+ return dynamic_cast<LwpAlignmentOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+LwpIndentOverride* LwpParaStyle::GetIndent()
+{
+ if (m_IndentStyle.obj() == nullptr)
+ return nullptr;
+
+ LwpIndentPiece *pPiece = dynamic_cast<LwpIndentPiece*>(m_IndentStyle.obj().get());
+ if (pPiece)
+ return dynamic_cast<LwpIndentOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+LwpSpacingOverride* LwpParaStyle::GetSpacing()
+{
+ if (m_SpacingStyle.obj() == nullptr)
+ return nullptr;
+
+ LwpSpacingPiece *pPiece = dynamic_cast<LwpSpacingPiece*>(m_SpacingStyle.obj().get());
+ if (pPiece)
+ return dynamic_cast<LwpSpacingOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+LwpParaBorderOverride* LwpParaStyle::GetParaBorder() const
+{
+ if(m_BorderStyle.IsNull())
+ return nullptr;
+
+ LwpParaBorderPiece *pPiece = dynamic_cast<LwpParaBorderPiece*>(m_BorderStyle.obj(VO_PARABORDERPIECE).get());
+ if (pPiece)
+ return dynamic_cast<LwpParaBorderOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+LwpBreaksOverride* LwpParaStyle::GetBreaks() const
+{
+ if(m_BreaksStyle.IsNull())
+ return nullptr;
+
+ LwpBreaksPiece *pPiece = dynamic_cast<LwpBreaksPiece*>(m_BreaksStyle.obj(VO_BREAKSPIECE).get());
+ if (pPiece)
+ return dynamic_cast<LwpBreaksOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+
+LwpNumberingOverride* LwpParaStyle::GetNumberingOverride() const
+{
+ if(m_NumberingStyle.IsNull())
+ return nullptr;
+
+ LwpNumberingPiece *pPiece = dynamic_cast<LwpNumberingPiece*>(m_NumberingStyle.obj(VO_NUMBERINGPIECE).get());
+ if (pPiece)
+ return dynamic_cast<LwpNumberingOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+LwpTabOverride* LwpParaStyle::GetTabOverride() const
+{
+ if(m_TabStyle.obj() == nullptr)
+ return nullptr;
+ LwpTabPiece *pPiece = dynamic_cast<LwpTabPiece*>(m_TabStyle.obj().get());
+ if (pPiece)
+ return dynamic_cast<LwpTabOverride*>(pPiece->GetOverride());
+ return nullptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpparastyle.hxx b/lotuswordpro/source/filter/lwpparastyle.hxx
new file mode 100644
index 000000000..28f3eea03
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpparastyle.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARASTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARASTYLE_HXX
+
+#include "lwpcharacterstyle.hxx"
+#include "lwpborderstuff.hxx"
+#include "lwppara.hxx"
+
+class LwpKinsokuOptsOverride;
+class LwpBulletOverride;
+class XFParaStyle;
+class XFBorders;
+
+class LwpParaStyle : public LwpTextStyle
+{
+public:
+ LwpParaStyle(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+
+ virtual ~LwpParaStyle() override;
+
+ void Read() override;
+
+ void Apply(XFParaStyle *pStrm);
+ static void ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverride* pBorder);
+ static void ApplyBreaks(XFParaStyle* pParaStyle, const LwpBreaksOverride* pBreaks);
+ static void ApplyAlignment(XFParaStyle* pParaStyle, const LwpAlignmentOverride* pAlign);
+ static void ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, const LwpIndentOverride* pIndent);
+ static void ApplySpacing(LwpPara* pPara, XFParaStyle* pParaStyle, LwpSpacingOverride* pSpacing);
+
+ static void ApplyTab(XFParaStyle* pParaStyle, LwpTabOverride* pTab);
+
+ void RegisterStyle() override;
+
+ LwpAlignmentOverride* GetAlignment();
+ LwpIndentOverride* GetIndent();
+ LwpSpacingOverride* GetSpacing();
+ LwpParaBorderOverride* GetParaBorder() const;
+ LwpBreaksOverride* GetBreaks() const;
+ LwpTabOverride* GetTabOverride() const;
+ const LwpBulletOverride& GetBulletOverride() const { return m_BulletOverride; }
+ LwpNumberingOverride* GetNumberingOverride() const;
+public:
+ static void ApplySubBorder(LwpBorderStuff* pBorderStuff, LwpBorderStuff::BorderType eType, XFBorders* pXFBorders);
+
+private:
+ //style IDs
+ LwpObjectID m_AlignmentStyle;
+ LwpObjectID m_SpacingStyle;
+ LwpObjectID m_IndentStyle;
+ LwpObjectID m_BorderStyle;
+ LwpObjectID m_BreaksStyle;
+ LwpObjectID m_NumberingStyle;
+ LwpObjectID m_TabStyle;
+ LwpObjectID m_BackgroundStyle;
+
+ LwpKinsokuOptsOverride m_KinsokuOptsOverride;
+ LwpBulletOverride m_BulletOverride;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppiece.hxx b/lotuswordpro/source/filter/lwppiece.hxx
new file mode 100644
index 000000000..707c4e542
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppiece.hxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPIECE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPIECE_HXX
+
+#include <lwpoverride.hxx>
+#include "lwpdlvlist.hxx"
+#include "lwpbreaksoverride.hxx"
+#include "lwpparaborderoverride.hxx"
+#include "lwpnumberingoverride.hxx"
+#include "lwpcharborderoverride.hxx"
+#include "lwpbackgroundoverride.hxx"
+#include "lwptaboverride.hxx"
+
+class LwpOverride;
+class LwpDLVList;
+
+class LwpVirtualPiece : public LwpDLVList
+{
+public:
+ LwpVirtualPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpDLVList(objHdr, pStrm)
+ {
+ }
+
+ virtual void Read() override
+ {
+ LwpDLVList::Read();
+ if( m_pOverride )
+ m_pOverride->Read(m_pObjStrm.get());
+ }
+
+ LwpOverride* GetOverride()
+ {
+ return m_pOverride.get();
+ }
+protected:
+ virtual ~LwpVirtualPiece() override
+ {
+ }
+
+ std::unique_ptr<LwpOverride> m_pOverride;
+};
+
+class LwpParaBorderPiece : public LwpVirtualPiece
+{
+public:
+ LwpParaBorderPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpParaBorderOverride());
+ }
+
+private:
+ virtual ~LwpParaBorderPiece() override {}
+};
+
+class LwpBreaksPiece : public LwpVirtualPiece
+{
+public:
+ LwpBreaksPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpBreaksOverride());
+ }
+
+private:
+ virtual ~LwpBreaksPiece() override {}
+};
+
+class LwpNumberingPiece : public LwpVirtualPiece
+{
+public:
+ LwpNumberingPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpNumberingOverride());
+ }
+
+private:
+ virtual ~LwpNumberingPiece() override {}
+};
+
+class LwpTabPiece : public LwpVirtualPiece
+{
+public:
+ LwpTabPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpTabOverride());
+ }
+
+private:
+ virtual ~LwpTabPiece() override {}
+};
+
+class LwpBackgroundPiece : public LwpVirtualPiece
+{
+public:
+ LwpBackgroundPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpBackgroundOverride());
+ }
+
+private:
+ virtual ~LwpBackgroundPiece() override {}
+};
+
+class LwpAlignmentPiece : public LwpVirtualPiece
+{
+public:
+ LwpAlignmentPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpAlignmentOverride());
+ }
+
+private:
+ virtual ~LwpAlignmentPiece() override {}
+};
+
+class LwpIndentPiece : public LwpVirtualPiece
+{
+public:
+ LwpIndentPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpIndentOverride());
+ }
+
+private:
+ virtual ~LwpIndentPiece() override {}
+};
+
+class LwpSpacingPiece : public LwpVirtualPiece
+{
+public:
+ LwpSpacingPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpSpacingOverride());
+ }
+
+private:
+ virtual ~LwpSpacingPiece() override {}
+};
+
+class LwpAmikakePiece : public LwpVirtualPiece
+{
+public:
+ LwpAmikakePiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpAmikakeOverride());
+ }
+
+private:
+ virtual ~LwpAmikakePiece() override {}
+};
+
+class LwpCharacterBorderPiece : public LwpVirtualPiece
+{
+public:
+ LwpCharacterBorderPiece(LwpObjectHeader const & objHdr, LwpSvStream* pStrm):LwpVirtualPiece(objHdr, pStrm)
+ {
+ m_pOverride.reset(new LwpCharacterBorderOverride());
+ }
+
+private:
+ virtual ~LwpCharacterBorderPiece() override {}
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpproplist.cxx b/lotuswordpro/source/filter/lwpproplist.cxx
new file mode 100644
index 000000000..9e4f6df28
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpproplist.cxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpproplist.hxx"
+
+LwpPropListElement::LwpPropListElement(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+:LwpDLVList(objHdr,pStrm)
+{
+}
+
+LwpPropListElement* LwpPropListElement::GetNext()
+{
+ return dynamic_cast<LwpPropListElement*>(LwpDLVList::GetNext().obj().get());
+}
+
+void LwpPropListElement::Read()
+{
+ LwpDLVList::Read();
+ m_Name.Read(m_pObjStrm.get());
+ m_Value.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+bool LwpPropListElement::IsNamed(const OUString& name)
+{
+ return name == m_Name.str();
+}
+
+OUString LwpPropList::GetNamedProperty(const OUString& name)
+{
+ LwpPropListElement* pProp = FindPropByName(name);
+ if (pProp)
+ {
+ return pProp->GetValue().str();
+ }
+ return OUString();
+}
+
+LwpPropListElement* LwpPropList::FindPropByName(const OUString& name)
+{
+ LwpPropListElement* pElement = GetFirst();
+
+ while(pElement)
+ {
+ if (pElement->IsNamed(name))
+ return pElement;
+ pElement = pElement->GetNext();
+ }
+ return nullptr;
+}
+
+LwpPropListElement* LwpPropList::GetFirst()
+{
+ return dynamic_cast<LwpPropListElement*>(LwpDLVListHead::GetFirst().obj().get());
+}
+
+OUString LwpPropList::EnumNamedProperty(OUString& name,OUString& value)
+{
+ LwpPropListElement* pElement;
+ if (name.isEmpty())
+ {
+ pElement = GetFirst();
+ if (pElement)
+ {
+ value = pElement->GetValue().str();
+ name = pElement->GetName().str();
+ pElement = pElement->GetNext();
+ if(pElement)
+ return pElement->GetName().str();
+ }
+ return OUString();
+ }
+ else
+ {
+ pElement = FindPropByName(name);
+ if (pElement)
+ {
+ value = pElement->GetValue().str();
+ pElement = pElement->GetNext();
+ if(pElement)
+ return pElement->GetName().str();
+ }
+ return OUString();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpproplist.hxx b/lotuswordpro/source/filter/lwpproplist.hxx
new file mode 100644
index 000000000..f9f9e4ee1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpproplist.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPROPLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPROPLIST_HXX
+
+#include "lwpdlvlist.hxx"
+#include <lwpatomholder.hxx>
+
+class LwpPropListElement : public LwpDLVList
+{
+public:
+ LwpPropListElement(LwpObjectHeader const &objHdr, LwpSvStream *pStrm);
+ void Read() override;
+ bool IsNamed(const OUString& name);
+ LwpPropListElement* GetNext();
+ const LwpAtomHolder& GetValue() const {return m_Value;}
+ const LwpAtomHolder& GetName() const {return m_Name;}
+private:
+ virtual ~LwpPropListElement() override {}
+
+ LwpAtomHolder m_Name;
+ LwpAtomHolder m_Value;
+};
+
+class LwpPropList : public LwpDLVListHead
+{
+public:
+ LwpPropList(){}
+ using LwpDLVListHead::Read;
+ LwpPropListElement* GetFirst();
+ OUString GetNamedProperty(const OUString& name);
+ OUString EnumNamedProperty(OUString& name,OUString& value);
+private:
+ LwpPropListElement* FindPropByName(const OUString& name);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpprtinfo.cxx b/lotuswordpro/source/filter/lwpprtinfo.cxx
new file mode 100644
index 000000000..574265690
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpprtinfo.cxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "lwpprtinfo.hxx"
+#include <lwpatomholder.hxx>
+
+LwpPrinterInfo::LwpPrinterInfo(LwpObjectStream* pStrm)
+{
+ Skip(pStrm);
+}
+/**
+ * @descr skip printer info in VO_DOCUMENT
+ */
+void LwpPrinterInfo::Skip(LwpObjectStream *pStrm)
+{
+ /*sal_uInt16 platform =*/ pStrm->QuickReaduInt16();
+
+ //Skip the size and the buffer
+ sal_uInt32 size = pStrm->QuickReaduInt32();
+ pStrm->SeekRel(static_cast<sal_uInt16>(size));
+
+ //Skip other printer info
+ pStrm->SeekRel(6*sizeof(sal_uInt16)+sizeof(sal_uInt32)+sizeof(sal_uInt16));
+
+ //Skip the next five LwpAtomHolder
+ {
+ LwpAtomHolder toSkip;
+ toSkip.Skip(pStrm);
+ toSkip.Skip(pStrm);
+ toSkip.Skip(pStrm);
+ toSkip.Skip(pStrm);
+ toSkip.Skip(pStrm);
+ }
+
+ sal_uInt16 count = pStrm->QuickReaduInt16();
+ //Skip each selected division
+ LwpAtomHolder toSkip;
+ while(count--)
+ {
+ toSkip.Skip(pStrm);
+ pStrm->SkipExtra();
+ }
+ pStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpprtinfo.hxx b/lotuswordpro/source/filter/lwpprtinfo.hxx
new file mode 100644
index 000000000..95b4df109
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpprtinfo.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPRTINFO_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPRTINFO_HXX
+
+#include <lwpobjstrm.hxx>
+/**
+ * @brief printer info used in VO_DOCUMENT
+ * not parsed yet
+*/
+class LwpPrinterInfo
+{
+public:
+ explicit LwpPrinterInfo(LwpObjectStream* pStrm);
+
+public:
+ static void Skip(LwpObjectStream* pStrm);
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwppttntbl.hxx b/lotuswordpro/source/filter/lwppttntbl.hxx
new file mode 100644
index 000000000..a0774fbbb
--- /dev/null
+++ b/lotuswordpro/source/filter/lwppttntbl.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype
+ * WordPro Pattern Table
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPTTNTBL_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPTTNTBL_HXX
+
+#include <sal/types.h>
+
+static const sal_uInt8 s_pLwpPatternTab[][8] = { //Id Name
+ { 0xDF, 0xAF, 0x77, 0x77, 0x77, 0x77, 0xFA, 0xFD },//0 Transparent
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },//1 SolidForeground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0x7F, 0xFF, 0xF7, 0xFF, 0x7F, 0xFF, 0xF7, 0xFF },//3 BACK_10PCTDOTS(31 GrayScale4thLightest)
+ { 0x77, 0xFF, 0xDD, 0xFF, 0x77, 0xFF, 0xDD, 0xFF },//4 BACK_30PCTDOTS(30 GrayScale5thLightest)
+ { 0x6F, 0xFF, 0xB5, 0xFF, 0xB5, 0xFF, 0xDA, 0xFF },//5 BACK_50PCTDOTS
+ { 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD },//6
+ { 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 },//7
+ { 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88 },//8
+ { 0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88, 0x00 },//9
+ { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 },//10
+ { 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 },//11
+ { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },//12
+ { 0xB1, 0x30, 0x03, 0x1B, 0xD8, 0xC0, 0x0C, 0x8D },//13
+ { 0x80, 0x10, 0x02, 0x20, 0x01, 0x08, 0x40, 0x04 },//14
+ { 0x33, 0x99, 0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66 },//15
+ { 0x77, 0xBB, 0xDD, 0xEE, 0x77, 0xBB, 0xDD, 0xEE },//16
+ { 0x6F, 0xB7, 0xDB, 0xED, 0xF6, 0x7B, 0xBD, 0xDE },//17
+ { 0x5F, 0xAF, 0xD7, 0xEB, 0xF5, 0xFA, 0x7D, 0xBE },//18
+ { 0xEA, 0x75, 0xBA, 0x5D, 0xAE, 0x57, 0xAB, 0xD5 },//19
+ { 0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE },//20
+ { 0xCC, 0x99, 0x33, 0x66, 0xCC, 0x99, 0x33, 0x66 },//21
+ { 0xEE, 0xDD, 0xBB, 0x77, 0xEE, 0xDD, 0xBB, 0x77 },//22
+ { 0xDE, 0xBD, 0x7B, 0xF6, 0xED, 0xDB, 0xB7, 0x6F },//23
+ { 0xFA, 0xF5, 0xEB, 0xD7, 0xAF, 0x5F, 0xBE, 0x7D },//24
+ { 0x57, 0xAE, 0x5D, 0xBA, 0x75, 0xEA, 0xD5, 0xAB },//25
+ { 0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F },//26
+ { 0x44, 0xAA, 0x11, 0xAA, 0x44, 0xAA, 0x11, 0xAA },//27
+ { 0xBB, 0x55, 0xEE, 0x55, 0xBB, 0x55, 0xEE, 0x55 },//28
+ { 0x7E, 0xBD, 0xDB, 0xE7, 0xE7, 0xDB, 0xBD, 0x7E },//29
+ { 0xF9, 0xF6, 0x6F, 0x9F, 0x9F, 0x6F, 0xF6, 0xF9 },//30
+ { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF },//31
+ { 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00 },//32
+ { 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF },//33
+ { 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//34
+ { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 },//35
+ { 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99 },//36
+ { 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB },//37
+ { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE },//38
+ { 0xFF, 0x55, 0xFF, 0x55, 0xFF, 0x55, 0xFF, 0x55 },//39
+ { 0xBB, 0xBB, 0x00, 0xBB, 0xBB, 0xBB, 0x00, 0xBB },//40
+ { 0x00, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD },//41
+ { 0x22, 0x00, 0x20, 0x00, 0xAA, 0x00, 0x20, 0x00 },//42
+ { 0x40, 0xA0, 0x00, 0x00, 0x04, 0x0A, 0x00, 0x00 },//43
+ { 0x01, 0x80, 0x00, 0x08, 0x10, 0x20, 0x00, 0x02 },//44
+ { 0xED, 0xED, 0x0C, 0xC0, 0xDE, 0xDE, 0xC0, 0x0C },//45
+ { 0xC1, 0xE2, 0x77, 0x2E, 0x1C, 0x3A, 0x77, 0xA3 },//46
+ { 0x00, 0xF7, 0xF7, 0xF7, 0x00, 0x7F, 0x7F, 0x7F },//47
+ { 0x7C, 0xBB, 0xC7, 0xEF, 0xDF, 0xBF, 0x7F, 0xFE },//48
+ { 0xFF, 0x33, 0xFF, 0xCC, 0xFF, 0x33, 0xFF, 0xCC },//49
+ { 0xCC, 0xCC, 0x33, 0x33, 0x33, 0x33, 0xCC, 0xCC },//50
+ { 0xF0, 0xF0, 0x0F, 0x0F, 0xF0, 0xF0, 0x0F, 0x0F },//51
+ { 0xC3, 0xC3, 0xC3, 0xC3, 0x3C, 0x3C, 0x3C, 0x3C },//52
+ { 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC },//53
+ { 0x08, 0x08, 0x14, 0x22, 0xC9, 0x22, 0x14, 0x08 },//54
+ { 0x0A, 0x04, 0x04, 0x55, 0xA0, 0x40, 0x40, 0x55 },//55
+ { 0x01, 0x01, 0x03, 0x84, 0x48, 0x30, 0x0C, 0x02 },//56
+ { 0x28, 0xC7, 0x01, 0x01, 0x82, 0x7C, 0x10, 0x10 },//57
+ { 0x40, 0x80, 0x01, 0x02, 0x04, 0x8A, 0x55, 0xFF },//58
+ { 0xC7, 0xC7, 0xBB, 0x4C, 0x7C, 0x7C, 0xBB, 0xC4 },//59
+ { 0x8A, 0x05, 0x02, 0x00, 0x02, 0x05, 0x8A, 0x55 },//60
+ { 0x28, 0x44, 0x82, 0x11, 0x00, 0x55, 0x00, 0x11 },//61
+ { 0x81, 0x41, 0x60, 0x70, 0x78, 0x70, 0x60, 0x41 },//62
+ { 0xEE, 0x57, 0xAB, 0x55, 0xEE, 0x5D, 0xBA, 0x75 },//63
+
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },//2 SolidBackground
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpresource.hxx b/lotuswordpro/source/filter/lwpresource.hxx
new file mode 100644
index 000000000..37dfe70e5
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpresource.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPRESOURCE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPRESOURCE_HXX
+
+#define IMPLEMENTATION_NAME "com.ibm.ILWPImportFilter"
+
+const char STR_WORDPRO[] = "Wordpro";
+const char STR_IMPLEMENTATION_NAME[] = IMPLEMENTATION_NAME;
+const char STR_SERVICE_NAME[] = "com.sun.star.document.ImportFilter";
+const char STR_WRITER_IMPORTER_NAME[] = "com.sun.star.comp.Writer.XMLImporter";
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
new file mode 100644
index 000000000..cb350f891
--- /dev/null
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -0,0 +1,500 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - row layouts
+ */
+
+#include "lwprowlayout.hxx"
+#include "lwptable.hxx"
+#include <lwpglobalmgr.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfrow.hxx>
+#include <xfilter/xfrowstyle.hxx>
+#include <xfilter/xftablestyle.hxx>
+#include <xfilter/xftable.hxx>
+#include <xfilter/xfcell.hxx>
+#include <xfilter/xfcellstyle.hxx>
+#include <o3tl/sorted_vector.hxx>
+
+LwpRowLayout::LwpRowLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpVirtualLayout(objHdr, pStrm)
+ , crowid(0)
+ , cheight(0)
+ , cLeaderDotCount(0)
+ , cLeaderDotY(0)
+ , cRowFlags(0)
+{
+ m_ConnCellList.clear();
+}
+
+LwpRowLayout::~LwpRowLayout()
+{}
+
+/**
+ * @short register row style
+ * @param
+ * @param
+ * @param
+ * @return
+ */
+void LwpRowLayout::SetRowMap()
+{
+ LwpObjectID *pCellID= &GetChildHead();
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+
+ o3tl::sorted_vector<LwpCellLayout*> aSeen;
+ while(pCellLayout)
+ {
+ aSeen.insert(pCellLayout);
+ pCellLayout->SetCellMap();
+
+ pCellID = &pCellLayout->GetNext();
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+ if (aSeen.find(pCellLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+}
+/**
+ * @short register row style
+ * @param
+ * @param
+ * @param
+ * @return
+ */
+void LwpRowLayout::RegisterStyle()
+{
+ // register row style
+ std::unique_ptr<XFRowStyle> pRowStyle(new XFRowStyle());
+
+ if (m_nDirection & 0x0030)
+ {
+ pRowStyle->SetMinRowHeight(static_cast<float>(LwpTools::ConvertFromUnitsToMetric(cheight)));
+ }
+ else
+ {
+ pRowStyle->SetRowHeight(static_cast<float>(LwpTools::ConvertFromUnitsToMetric(cheight)));
+ }
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(pRowStyle)).m_pStyle->GetStyleName();
+
+ LwpTableLayout* pTableLayout = GetParentTableLayout();
+ if (pTableLayout)
+ {
+ pTableLayout->GetTable();
+ }
+ // register cells' style
+ LwpObjectID *pCellID= &GetChildHead();
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+
+ o3tl::sorted_vector<LwpCellLayout*> aSeen;
+ while (pCellLayout)
+ {
+ aSeen.insert(pCellLayout);
+
+ pCellLayout->SetFoundry(m_pFoundry);
+ pCellLayout->RegisterStyle();
+ pCellID = &pCellLayout->GetNext();
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+
+ if (aSeen.find(pCellLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+
+}
+/**
+ * @short register row style
+ * @param
+ * @param
+ * @param
+ * @return
+ */
+void LwpRowLayout::Read()
+{
+ #define MAXUNIT (0x7fffffffL) // Highest positive UNIT value
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+
+ LwpVirtualLayout::Read();
+
+ //skip CLiteLayout data;
+ LwpAtomHolder ContentClass;
+ ContentClass.Read(pStrm);
+ pStrm->SkipExtra();
+
+ // Row layout content
+ crowid = pStrm->QuickReaduInt16();
+ cheight = pStrm->QuickReadInt32();
+ cLeaderDotCount = static_cast<sal_uInt8>(pStrm->QuickReaduInt16()); // was written as lushort.
+ cLeaderDotY = MAXUNIT; // Sentinel meaning "not calculated yet"
+ cRowFlags = static_cast<sal_uInt8>(pStrm->QuickReaduInt16()); // was written as lushort.
+
+ pStrm->SkipExtra();
+}
+
+/**
+ * @short Parse rows with connect cell
+ * @param pXFTable - pointer to created XFTable
+ */
+void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8 nStartCol,sal_uInt8 nEndCol)
+{
+ LwpTableLayout* pTableLayout = GetParentTableLayout();
+ if (!pTableLayout)
+ throw std::runtime_error("missing TableLayout");
+ LwpTable* pTable = pTableLayout->GetTable();
+
+ //calculate the connected cell position
+ sal_Int32 nMarkConnCell = FindMarkConnCell(nStartCol,nEndCol);
+
+ //if there is no connected cell
+ if (nMarkConnCell == -1)
+ {
+ ConvertCommonRow(pXFTable,nStartCol,nEndCol);
+ return;
+ }
+
+ //register connect row style
+ sal_uInt16 nRowMark = crowid + GetCurMaxSpannedRows(nStartCol,nEndCol);
+ rtl::Reference<XFRow> xXFRow(new XFRow);
+ RegisterCurRowStyle(xXFRow.get(), nRowMark);
+
+ //if there is connected cell
+ for (sal_uInt8 i=nStartCol; i<nEndCol; )
+ {
+ rtl::Reference<XFCell> xXFCell;
+ sal_uInt8 nColMark;
+
+ if (nMarkConnCell == -1)
+ nColMark = nEndCol;
+ else
+ nColMark = m_ConnCellList[nMarkConnCell]->GetColID();
+
+ if (nColMark > i)//create subtable
+ {
+ xXFCell.set(new XFCell);
+ xXFCell->SetColumnSpaned(nColMark-i);
+ rtl::Reference<XFTable> xSubTable(new XFTable);
+ pTableLayout->ConvertTable(xSubTable,crowid,nRowMark,i,nColMark);
+ xXFCell->Add(xSubTable.get());
+ i = nColMark;
+ }
+ else
+ {
+ sal_uInt8 nColID = m_ConnCellList[nMarkConnCell]->GetColID()
+ +m_ConnCellList[nMarkConnCell]->GetNumcols()-1;
+ xXFCell = m_ConnCellList[nMarkConnCell]->DoConvertCell(
+ pTable->GetObjectID(),
+ crowid+m_ConnCellList[nMarkConnCell]->GetNumrows()-1,
+ m_ConnCellList[nMarkConnCell]->GetColID());
+
+ //set all cell in this merge cell to cellsmap
+ for (sal_uInt16 nRowLoop = crowid; nRowLoop < nRowMark; nRowLoop++)
+ for (sal_uInt16 nColLoop = i; nColLoop < nColID+1; nColLoop++)
+ pTableLayout->SetCellsMap(nRowLoop,nColLoop, xXFCell.get());
+
+ i += m_ConnCellList[nMarkConnCell]->GetNumcols();
+ nMarkConnCell = FindNextMarkConnCell(static_cast<sal_uInt16>(nMarkConnCell),nEndCol);
+ }
+
+ if (xXFCell)
+ xXFRow->AddCell(xXFCell);
+ }
+ pXFTable->AddRow(xXFRow);
+}
+
+/**
+ * @short register row style in SODC table
+ * @param pXFRow - pointer of row
+ * @param nRowMark - spanned row number
+ */
+void LwpRowLayout::RegisterCurRowStyle(XFRow* pXFRow,sal_uInt16 nRowMark)
+{
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFRowStyle* pRowStyle = static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(m_StyleName));
+ if (!pRowStyle)
+ return;
+ double fHeight = pRowStyle->GetRowHeight();
+
+ std::unique_ptr<XFRowStyle> pNewStyle(new XFRowStyle);
+ *pNewStyle = *pRowStyle;
+ LwpTableLayout* pTableLayout = GetParentTableLayout();
+ if (!pTableLayout)
+ {
+ return;
+ }
+ std::map<sal_uInt16,LwpRowLayout*> RowsMap = pTableLayout->GetRowsMap();
+
+ for (sal_uInt16 i=crowid+1; i<nRowMark;i++)
+ {
+ std::map<sal_uInt16,LwpRowLayout*>::iterator iter = RowsMap.find(i);
+ if (iter == RowsMap.end())
+ {
+ pRowStyle = static_cast<XFRowStyle*>(
+ pXFStyleManager->FindStyle(pTableLayout->GetDefaultRowStyleName()));
+ }
+ else
+ {
+ pRowStyle = static_cast<XFRowStyle*>(
+ pXFStyleManager->FindStyle(iter->second->GetStyleName()));
+ }
+ if (!pRowStyle)
+ throw std::runtime_error("missing RowStyle");
+ fHeight += pRowStyle->GetRowHeight();
+ }
+
+ if (m_nDirection & 0x0030)
+ {
+ pNewStyle->SetMinRowHeight(static_cast<float>(fHeight));
+ }
+ else
+ {
+ pNewStyle->SetRowHeight(static_cast<float>(fHeight));
+ }
+
+ pXFRow->SetStyleName(pXFStyleManager->AddStyle(std::move(pNewStyle)).m_pStyle->GetStyleName());
+}
+
+/**
+ * @short find max merge cell in a given column range
+ * @param nStartCol - start column ID
+ * @param nEndCol - end column ID
+ */
+sal_Int32 LwpRowLayout::FindMarkConnCell(sal_uInt8 nStartCol,sal_uInt8 nEndCol)
+{
+ if (m_ConnCellList.empty())
+ return -1;
+
+ sal_uInt16 nSpannRows = 1;
+ sal_Int32 nMarkConnCell = -1;
+
+ for (size_t i=0;i<m_ConnCellList.size();i++)
+ {
+ if (m_ConnCellList[i]->GetColID()>=nEndCol)
+ break;
+ if (m_ConnCellList[i]->GetColID()>=nStartCol)
+ {
+ if (m_ConnCellList[i]->GetNumrows()>nSpannRows)
+ {
+ nSpannRows = m_ConnCellList[i]->GetNumrows();
+ nMarkConnCell = i;
+ }
+ }
+ }
+ return nMarkConnCell;
+}
+
+/**
+ * @short find next merge cell with the same spanned row number with current merge cell
+ * @param nStartCol - start column ID
+ * @param nEndCol - end column ID
+ */
+sal_Int32 LwpRowLayout::FindNextMarkConnCell(sal_uInt16 nMarkConnCell,sal_uInt8 nEndCol)
+{
+ sal_uInt16 nMaxRows = m_ConnCellList[nMarkConnCell]->GetNumrows();
+
+ for (size_t i=nMarkConnCell+1;i<m_ConnCellList.size();i++)
+ {
+ if (m_ConnCellList[i]->GetColID()>=nEndCol)
+ break;
+ if (m_ConnCellList[i]->GetNumrows() == nMaxRows)
+ {
+ return i;
+ }
+ }
+ return -1;
+}
+/**
+ * @short get max spanned row numbers in a given column range
+ * @param nStartCol - start column ID
+ * @param nEndCol - end column ID
+ */
+sal_uInt16 LwpRowLayout::GetCurMaxSpannedRows(sal_uInt8 nStartCol,sal_uInt8 nEndCol)
+{
+ sal_Int32 nMarkConnCell = FindMarkConnCell(nStartCol,nEndCol);
+ if (nMarkConnCell == -1)
+ return 1;
+ else
+ return m_ConnCellList[nMarkConnCell]->GetNumrows();
+}
+/**
+ * @short convert row with rowlayout,but no merge cells
+ * @param pXFTable - pointer of table
+ * @param nStartCol - start column ID
+ * @param nEndCol - end column ID
+ */
+void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol, sal_uInt8 nEndCol)
+{
+ LwpTableLayout* pTableLayout = GetParentTableLayout();
+ if (!pTableLayout)
+ return;
+ LwpTable* pTable = pTableLayout->GetTable();
+ if (!pTable)
+ return;
+
+ rtl::Reference<XFRow> xRow(new XFRow);
+ xRow->SetStyleName(m_StyleName);
+
+ sal_uInt8 nCellStartCol,nCellEndCol;
+
+ for (sal_uInt8 i = nStartCol; i < nEndCol ; i++)
+ {
+ // add row to table
+ LwpObjectID *pCellID= &GetChildHead();
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+ nCellStartCol = i;//mark the begin position of cell
+ nCellEndCol = i;//mark the end position of cell
+ rtl::Reference<XFCell> xCell;
+ while(pCellLayout)
+ {
+ if (pCellLayout->GetColID() == i)
+ {
+ if (pCellLayout->GetLayoutType() == LWP_CONNECTED_CELL_LAYOUT)
+ {
+ LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout*>(pCellLayout);
+ auto nNumCols = pConnCell->GetNumcols();
+ if (!nNumCols)
+ throw std::runtime_error("loop in conversion");
+ auto nNewEndCol = i + nNumCols - 1;
+ if (nNewEndCol > std::numeric_limits<sal_uInt8>::max())
+ throw std::range_error("column index too large");
+ nCellEndCol = nNewEndCol;
+ i = nCellEndCol;
+ }
+ xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i);
+ break;
+ }
+ pCellID = &pCellLayout->GetNext();
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+ }
+ if (!pCellLayout)
+ {
+ // if table has default cell layout, use it to ConvertCell
+ // otherwise use blank cell
+ LwpCellLayout * pDefaultCell = pTableLayout->GetDefaultCellLayout();
+ if (pDefaultCell)
+ {
+ xCell = pDefaultCell->DoConvertCell(
+ pTable->GetObjectID(),crowid, i);
+ }
+ else
+ {
+ xCell.set(new XFCell);
+ }
+ }
+ xRow->AddCell(xCell);
+
+ for (sal_uInt8 j=nCellStartCol;j<=nCellEndCol;j++)
+ pTableLayout->SetCellsMap(crowid,j, xCell.get());//set to cellsmap
+ }
+
+ pXFTable->AddRow(xRow);
+}
+/**
+ * @short collect merge cell info when register row styles
+ */
+void LwpRowLayout::CollectMergeInfo()
+{
+ LwpObjectID *pCellID= &GetChildHead();
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+
+ while(pCellLayout)
+ {
+ if (pCellLayout->GetLayoutType() == LWP_CONNECTED_CELL_LAYOUT)
+ {
+ LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout*>(pCellLayout);
+ m_ConnCellList.push_back(pConnCell);
+ }
+ pCellID = &pCellLayout->GetNext();
+ pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
+ }
+}
+/**
+ * @short split merge cells in this row
+ * @param nEffectRows - max spanned number of previous row
+ */
+void LwpRowLayout::SetCellSplit(sal_uInt16 nEffectRows)
+{
+ for (LwpConnectedCellLayout* pConnCell : m_ConnCellList)
+ {
+ sal_uInt16 nRowSpan = pConnCell->GetRowID()+pConnCell->GetNumrows();
+ if ( nRowSpan > nEffectRows )
+ {
+ pConnCell->SetNumrows(nEffectRows - pConnCell->GetRowID());
+ }
+ }
+}
+/**
+ * @short check if the row has merge cell
+ */
+bool LwpRowLayout::GetMergeCellFlag() const
+{
+ return !m_ConnCellList.empty();
+}
+
+LwpRowHeadingLayout::LwpRowHeadingLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpRowLayout(objHdr, pStrm)
+{}
+
+LwpRowHeadingLayout::~LwpRowHeadingLayout()
+{}
+void LwpRowHeadingLayout::Read()
+{
+ LwpRowLayout::Read();
+
+ cRowLayout.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwprowlayout.hxx b/lotuswordpro/source/filter/lwprowlayout.hxx
new file mode 100644
index 000000000..ad2c9eacb
--- /dev/null
+++ b/lotuswordpro/source/filter/lwprowlayout.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - row layouts
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPROWLAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPROWLAYOUT_HXX
+
+#include "lwplayout.hxx"
+#include "lwptablelayout.hxx"
+#include "lwpcelllayout.hxx"
+
+class XFRow;
+class XFTable;
+class LwpTableLayout;
+/**
+ * @brief
+ * VO_ROWLAYOUT obj
+ */
+class LwpRowLayout : public LwpVirtualLayout
+{
+public:
+ LwpRowLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpRowLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_ROW_LAYOUT;}
+ sal_uInt16 GetRowID() const { return crowid;}
+ virtual void RegisterStyle() override;
+ LwpTableLayout * GetParentTableLayout(){return dynamic_cast<LwpTableLayout *>(GetParent().obj().get());}
+ void SetRowMap();
+protected:
+ void Read() override;
+ sal_uInt16 crowid;
+ sal_Int32 cheight; // Minimum height if height is automatic.
+ sal_uInt8 cLeaderDotCount; // dfb - # of cells with leader dots
+ sal_Int32 cLeaderDotY;
+ sal_uInt8 cRowFlags;
+ enum // for cRowFlags
+ {
+ RF_HAS_BORDER = 0x01,
+ RF_VALID_HAS_BORDER = 0x02,
+ RF_LEADER_COUNT_VALID = 0x4
+ };
+private:
+ std::vector<LwpConnectedCellLayout*> m_ConnCellList;
+ sal_Int32 FindMarkConnCell(sal_uInt8 nStartCol,sal_uInt8 nEndCol);
+ sal_Int32 FindNextMarkConnCell(sal_uInt16 nMarkConnCell,sal_uInt8 nEndCol);
+
+public:
+ void ConvertRow(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol, sal_uInt8 nEndCol);
+ void ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol, sal_uInt8 nEndCol);
+ void CollectMergeInfo();
+ void SetCellSplit(sal_uInt16 nEffectRows);
+ bool GetMergeCellFlag() const;
+ sal_uInt16 GetCurMaxSpannedRows(sal_uInt8 nStartCol,sal_uInt8 nEndCol);
+ void RegisterCurRowStyle(XFRow* pXFRow,sal_uInt16 nRowMark);
+};
+
+/**
+ * @brief
+ * VO_ROWHEADINGLAYOUT obj
+ */
+class LwpRowHeadingLayout : public LwpRowLayout
+{
+public:
+ LwpRowHeadingLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpRowHeadingLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_ROW_HEADING_LAYOUT;}
+protected:
+ void Read() override;
+private:
+ LwpObjectID cRowLayout;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwdrawheader.hxx b/lotuswordpro/source/filter/lwpsdwdrawheader.hxx
new file mode 100644
index 000000000..3153b837a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwdrawheader.hxx
@@ -0,0 +1,354 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype
+ * The file declares structures and enums used by Lwp-Drawing-Module
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWDRAWHEADER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWDRAWHEADER_HXX
+
+#include <config_lgpl.h>
+#include <sal/types.h>
+
+const sal_uInt8 DRAW_FACESIZE = 32;
+const double THRESHOLD = 0.0001;
+
+enum DrawObjectType
+{
+ OT_UNDEFINED = 0,
+
+ OT_SELECT = 0,
+ OT_HAND = 1,
+ OT_LINE = 2,
+ OT_PERPLINE = 3,
+ OT_POLYLINE = 4,
+ OT_POLYGON = 5,
+ OT_RECT = 6,
+ OT_SQUARE = 7,
+ OT_RNDRECT = 8,
+ OT_RNDSQUARE = 9,
+ OT_OVAL = 10,
+ OT_CIRCLE = 11,
+ OT_ARC = 12,
+ OT_TEXT = 13,
+ OT_GROUP = 14,
+ OT_CHART = 15,
+ OT_METAFILE = 16,
+ OT_METAFILEIMG = 17,
+ OT_BITMAP = 18,
+ OT_TEXTART = 19,
+ OT_BIGBITMAP = 20
+};
+
+enum DrawFillType
+{
+ FT_TRANSPARENT = 0,
+ FT_VLTGRAY = 1,
+ FT_LTGRAY = 2,
+ FT_GRAY = 3,
+ FT_DKGRAY = 4,
+ FT_SOLID = 5,
+ FT_HORZHATCH = 6,
+ FT_VERTHATCH = 7,
+ FT_FDIAGHATCH = 8,
+ FT_BDIAGHATCH = 9,
+ FT_CROSSHATCH = 10,
+ FT_DIAGCROSSHATCH = 11,
+ FT_PATTERN = 12
+};
+
+enum DrawLineStyle
+{
+ LS_SOLID = 0,
+ LS_DASH = 1,
+ LS_DOT = 2,
+ LS_DASHDOT = 3,
+ LS_DASHDOTDOT = 4,
+ LS_NULL = 5,
+ LS_INSIDEFRAME = 6
+};
+
+// Text Attributes as stored in Draw files V1.2 and earlier
+enum DrawTextAttribute
+{
+ TA_BOLD = 0x0001, /* bolded font */
+ TA_ITALIC = 0x0002, /* italic font */
+ TA_UNDERLINE = 0x0004, /* underlined font */
+ TA_WORDUNDERLINE = 0x0008, /* broken underline */
+ TA_ALLCAPS = 0x0010, /* capitalized font */
+ TA_SMALLCAPS = 0x0020, /* all small capital letters */
+ TA_DOUBLEUNDER = 0x0040, /* double underline */
+ TA_STRIKETHRU = 0x0080, /* strikethru */
+ TA_SUPERSCRIPT = 0x0100, /* superscript */
+ TA_SUBSCRIPT = 0x0200 /* subscript */
+};
+
+enum DrawArrowHead
+{
+ AH_ARROW_NONE = 0,
+ AH_ARROW_FULLARROW = 1,
+ AH_ARROW_HALFARROW = 2,
+ AH_ARROW_LINEARROW = 3,
+ AH_ARROW_INVFULLARROW = 4,
+ AH_ARROW_INVHALFARROW = 5,
+ AH_ARROW_INVLINEARROW = 6,
+ AH_ARROW_TEE = 7,
+ AH_ARROW_SQUARE = 8,
+ AH_ARROW_CIRCLE = 9
+};
+
+struct SdwPoint
+{
+ sal_Int16 x;
+ sal_Int16 y;
+ SdwPoint()
+ : x(0)
+ , y(0)
+ {
+ }
+};
+
+struct SdwColor
+{
+ sal_uInt8 nR;
+ sal_uInt8 nG;
+ sal_uInt8 nB;
+ sal_uInt8 unused;
+ SdwColor()
+ : nR(0)
+ , nG(0)
+ , nB(0)
+ , unused(0)
+ {
+ }
+};
+
+struct SdwClosedObjStyleRec
+{
+ sal_uInt8 nLineWidth = 0;
+ sal_uInt8 nLineStyle = 0;
+ SdwColor aPenColor;
+ SdwColor aForeColor;
+ SdwColor aBackColor;
+ sal_uInt16 nFillType = 0;
+ sal_uInt8 pFillPattern[8] = {};
+ SdwClosedObjStyleRec() = default;
+};
+
+struct SdwDrawObjHeader
+{
+ sal_uInt16 nRecLen;
+ sal_Int16 nLeft;
+ sal_Int16 nTop;
+ sal_Int16 nRight;
+ sal_Int16 nBottom;
+ SdwDrawObjHeader()
+ : nRecLen(0)
+ , nLeft(0)
+ , nTop(0)
+ , nRight(0)
+ , nBottom(0)
+ {
+ }
+};
+
+struct SdwLineRecord
+{
+ sal_Int16 nStartX;
+ sal_Int16 nStartY;
+ sal_Int16 nEndX;
+ sal_Int16 nEndY;
+ sal_uInt8 nLineWidth;
+ sal_uInt8 nLineEnd;
+ sal_uInt8 nLineStyle;
+ SdwColor aPenColor;
+ SdwLineRecord()
+ : nStartX(0)
+ , nStartY(0)
+ , nEndX(0)
+ , nEndY(0)
+ , nLineWidth(0)
+ , nLineEnd(0)
+ , nLineStyle(0)
+ {
+ }
+};
+
+struct SdwPolyLineRecord
+{
+ sal_uInt8 nLineWidth;
+ sal_uInt8 nLineEnd;
+ sal_uInt8 nLineStyle;
+ SdwColor aPenColor;
+ sal_uInt16 nNumPoints;
+ SdwPolyLineRecord()
+ : nLineWidth(0)
+ , nLineEnd(0)
+ , nLineStyle(0)
+ , nNumPoints(0)
+ {
+ }
+};
+
+struct SdwArcRecord
+{
+ sal_uInt8 nLineWidth;
+ sal_uInt8 nLineEnd;
+ sal_uInt8 nLineStyle;
+ SdwColor aPenColor;
+ SdwArcRecord()
+ : nLineWidth(0)
+ , nLineEnd(0)
+ , nLineStyle(0)
+ {
+ }
+};
+
+struct SdwTextBoxRecord
+{
+ sal_Int16 nTextWidth;
+ sal_Int16 nTextHeight;
+ sal_Int16 nTextSize;
+ SdwColor aTextColor;
+ sal_uInt8 tmpTextFaceName[DRAW_FACESIZE];
+ sal_uInt16 nTextAttrs;
+ sal_uInt16 nTextCharacterSet;
+ sal_Int16 nTextRotation;
+ sal_Int16 nTextExtraSpacing;
+ sal_uInt8* pTextString;
+};
+
+struct SdwFMPATH
+{
+ sal_uInt16 n;
+ SdwPoint* pPts;
+ SdwFMPATH()
+ : n(0)
+ , pPts(nullptr)
+ {
+ }
+};
+
+struct SdwTextArt : public SdwTextBoxRecord
+{
+ sal_uInt8 nIndex;
+ sal_Int16 nRotation;
+ sal_uInt16 nTextLen;
+ SdwFMPATH aPath[2];
+ SdwTextArt()
+ : nIndex(0)
+ , nRotation(0)
+ , nTextLen(0)
+ {
+ }
+};
+
+struct SdwBmpRecord
+{
+ sal_uInt16 nTranslation;
+ sal_uInt16 nRotation;
+ sal_uInt32 nFileSize;
+ SdwBmpRecord()
+ : nTranslation(0)
+ , nRotation(0)
+ , nFileSize(0)
+ {
+ }
+};
+
+struct BmpInfoHeader
+{
+ sal_uInt32 nHeaderLen;
+ sal_uInt16 nWidth;
+ sal_uInt16 nHeight;
+ sal_uInt16 nPlanes;
+ sal_uInt16 nBitCount;
+};
+
+struct BmpInfoHeader2
+{
+ sal_uInt32 nHeaderLen;
+ sal_uInt32 nWidth;
+ sal_uInt32 nHeight;
+ sal_uInt16 nPlanes;
+ sal_uInt16 nBitCount;
+};
+
+struct DrawingOffsetAndScale
+{
+ double fOffsetX;
+ double fOffsetY;
+ double fScaleX;
+ double fScaleY;
+ double fLeftMargin;
+ double fTopMargin;
+
+ DrawingOffsetAndScale()
+ {
+ fOffsetX = 0.00;
+ fOffsetY = 0.00;
+ fScaleX = 1.00;
+ fScaleY = 1.00;
+ fLeftMargin = 0.00;
+ fTopMargin = 0.00;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.cxx b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
new file mode 100644
index 000000000..0c19b3569
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/stream.hxx>
+
+#include "lwpsdwfileloader.hxx"
+#include "lwpsdwgrouploaderv0102.hxx"
+
+#include <xfilter/xfframe.hxx>
+
+LwpSdwFileLoader::LwpSdwFileLoader(SvStream* pStream, LwpGraphicObject* pGraphicObj)
+ : m_pStream(pStream)
+ , m_pGraphicObj(pGraphicObj)
+{
+ pStream->Seek(0);
+}
+
+LwpSdwFileLoader::~LwpSdwFileLoader()
+{
+}
+
+/**
+ * @descr entry of lwp-drawing objects.
+ * @param pDrawObjVector a container which will contains the created drawing object of XF-Model.
+ */
+void LwpSdwFileLoader::CreateDrawObjects(std::vector< rtl::Reference<XFFrame> >* pDrawObjVector)
+{
+ unsigned char BinSignature[2];
+ m_pStream->ReadBytes(BinSignature, 2);
+
+ if (!(BinSignature[0] == 'S' && BinSignature[1] == 'M'))
+ return;
+
+ unsigned short nVersion;
+ m_pStream->ReadUInt16(nVersion);
+
+ m_pStream->Seek(0);
+ if (nVersion<0x0102)
+ {
+ assert(false);
+ }
+ if (nVersion>=0x0102)
+ {
+ LwpSdwGroupLoaderV0102 sdwGroupLoader(m_pStream, m_pGraphicObj);
+ sdwGroupLoader.BeginDrawObjects(pDrawObjVector);
+ }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.hxx b/lotuswordpro/source/filter/lwpsdwfileloader.hxx
new file mode 100644
index 000000000..880139487
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwfileloader.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWFILELOADER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWFILELOADER_HXX
+
+#include <sal/config.h>
+#include <config_lgpl.h>
+
+#include <vector>
+
+#include <rtl/ref.hxx>
+
+class SvStream;
+class XFFrame;
+class LwpGraphicObject;
+class LwpSdwFileLoader
+{
+private:
+ SvStream* m_pStream;
+ LwpGraphicObject* m_pGraphicObj;
+
+public:
+ LwpSdwFileLoader(SvStream* pStream, LwpGraphicObject* pGraphicObj);
+ ~LwpSdwFileLoader();
+
+public:
+ void CreateDrawObjects(std::vector<rtl::Reference<XFFrame>>* pDrawObjVector);
+};
+
+#endif // INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWFILELOADER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
new file mode 100644
index 000000000..036f0ea72
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
@@ -0,0 +1,413 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/stream.hxx>
+
+#include "lwpsdwgrouploaderv0102.hxx"
+#include "lwpdrawobj.hxx"
+#include <lwptools.hxx>
+#include "lwpcharsetmgr.hxx"
+#include "lwpgrfobj.hxx"
+#include "lwpframelayout.hxx"
+
+#include <xfilter/xfcolor.hxx>
+#include <xfilter/xfdrawline.hxx>
+#include <xfilter/xfdrawpath.hxx>
+#include <xfilter/xfdrawpolyline.hxx>
+#include <xfilter/xfdrawrect.hxx>
+#include <xfilter/xfdrawpolygon.hxx>
+#include <xfilter/xfdrawgroup.hxx>
+#include <xfilter/xfdrawstyle.hxx>
+#include <xfilter/xfdrawlinestyle.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <sal/log.hxx>
+
+LwpSdwGroupLoaderV0102::LwpSdwGroupLoaderV0102(SvStream* pStream, LwpGraphicObject* pGraphicObj)
+ : m_pStream(pStream)
+ , m_pGraphicObj(pGraphicObj)
+ , m_pDrawObjVector(nullptr)
+{
+}
+
+LwpSdwGroupLoaderV0102::~LwpSdwGroupLoaderV0102()
+{
+}
+
+/**
+ * @descr entry of lwp-drawing objects. the function begins to parse the sdw-drawing bento stream and create
+ * the corresponding drawing objects.
+ * @param pDrawObjVector a container which will contains the created drawing object of XF-Model.
+ */
+void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFrame> >* pDrawObjVector)
+{
+ // save the container
+ m_pDrawObjVector = pDrawObjVector;
+
+ //flag
+ unsigned char BinSignature[2];
+ m_pStream->ReadBytes(BinSignature, 2);
+ if (BinSignature[0] != 'S' || BinSignature[1] != 'M')
+ {
+ assert(false);
+ return;
+ }
+ //version
+ unsigned short nVersion;
+ m_pStream->ReadUInt16(nVersion);
+ if (nVersion<0x0102)
+ {
+ assert(false);
+ return;
+ }
+ // topObj, botObj
+ m_pStream->SeekRel(4);
+ //record count
+ unsigned short nRecCount(0);
+ m_pStream->ReadUInt16(nRecCount);
+ // selCount
+ m_pStream->SeekRel(2);
+ //boundrect
+ unsigned short left(0),top(0),right(0),bottom(0);
+ m_pStream->ReadUInt16(left);
+ m_pStream->ReadUInt16(top);
+ m_pStream->ReadUInt16(right);
+ m_pStream->ReadUInt16(bottom);
+ // fileSize
+ m_pStream->SeekRel(2);
+
+ //for calculating transformation params.
+ rtl::Reference<LwpFrameLayout> xMyFrameLayout(dynamic_cast<LwpFrameLayout*>(m_pGraphicObj->GetLayout(nullptr).get()));
+ if (xMyFrameLayout.is())
+ {
+ LwpLayoutScale* pMyScale = xMyFrameLayout->GetLayoutScale();
+ LwpLayoutGeometry* pFrameGeo = xMyFrameLayout->GetGeometry();
+ if (pMyScale && pFrameGeo)
+ {
+ // original drawing size
+ long nWidth = 0, nHeight = 0;
+ m_pGraphicObj->GetGrafOrgSize(nWidth, nHeight);
+ double fGrafOrgWidth = static_cast<double>(nWidth)/TWIPS_PER_CM;
+ double fGrafOrgHeight = static_cast<double>(nHeight)/TWIPS_PER_CM;
+
+ // get margin values
+ double fLeftMargin = xMyFrameLayout->GetMarginsValue(MARGIN_LEFT);
+ double fTopMargin = xMyFrameLayout->GetMarginsValue(MARGIN_TOP);
+
+ // frame size
+ double fFrameWidth = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetWidth());
+ double fFrameHeight = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetHeight());
+
+ // get frame offset
+ LwpPoint& rOffset = pMyScale->GetOffset();
+ double fOffsetX = LwpTools::ConvertFromUnitsToMetric(rOffset.GetX());
+ double fOffsetY = LwpTools::ConvertFromUnitsToMetric(rOffset.GetY());
+
+ // get scale mode
+ sal_uInt16 nScalemode = pMyScale->GetScaleMode();
+
+ if (nScalemode & LwpLayoutScale::CUSTOM)
+ {
+ m_aTransformData.fScaleX =
+ LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth()) / fGrafOrgWidth;
+ m_aTransformData.fScaleY =
+ LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight()) / fGrafOrgHeight;
+ }
+ else if (nScalemode & LwpLayoutScale::PERCENTAGE)
+ {
+ double fScalePercentage = static_cast<double>(pMyScale->GetScalePercentage()) / 1000;
+ m_aTransformData.fScaleX = fScalePercentage;
+ m_aTransformData.fScaleY = fScalePercentage;
+ }
+ else if (nScalemode & LwpLayoutScale::FIT_IN_FRAME)
+ {
+ double fWidth0 = static_cast<double>(right) / TWIPS_PER_CM;
+ double fHeight0 = static_cast<double>(bottom) / TWIPS_PER_CM;
+
+ double fWidth1 = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth());
+ double fHeight1 = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight());
+
+ double fScaleX = fWidth1 / fWidth0;
+ double fScaleY = fHeight1 / fHeight0;
+
+ if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO)
+ {
+ m_aTransformData.fScaleX = std::min(fScaleX, fScaleY);
+ m_aTransformData.fScaleY = m_aTransformData.fScaleX;
+ }
+ else
+ {
+ m_aTransformData.fScaleX = fWidth1 / fWidth0;
+ m_aTransformData.fScaleY = fHeight1 / fHeight0;
+ }
+ }
+
+ // placement: centered
+ if (xMyFrameLayout->GetScaleCenter())
+ {
+ tools::Rectangle aBoundRect(static_cast<long>(left*m_aTransformData.fScaleX + fLeftMargin),
+ static_cast<long>(top * m_aTransformData.fScaleY + fTopMargin),
+ static_cast<long>(right * m_aTransformData.fScaleX),
+ static_cast<long>(bottom * m_aTransformData.fScaleY));
+ Point aCenter = aBoundRect.Center();
+
+ double fNewCenterX = (double(left)/TWIPS_PER_CM + fFrameWidth/*-fOffsetX*/) / 2;
+ double fNewCenterY = (double(top)/TWIPS_PER_CM + fFrameHeight/*-fOffsetY*/) / 2;
+
+ m_aTransformData.fOffsetX = fNewCenterX - static_cast<double>(aCenter.X())/TWIPS_PER_CM;
+ m_aTransformData.fOffsetY = fNewCenterY -static_cast<double>(aCenter.Y())/TWIPS_PER_CM;
+ }
+ else
+ {
+ m_aTransformData.fOffsetX = fOffsetX;
+ m_aTransformData.fOffsetY = fOffsetY;
+ }
+
+ m_aTransformData.fOffsetX += fLeftMargin;
+ m_aTransformData.fOffsetY += fTopMargin;
+ m_aTransformData.fLeftMargin = fLeftMargin;
+ m_aTransformData.fTopMargin = fTopMargin;
+ }
+ }
+
+ if (nRecCount > m_pStream->remainingSize())
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ nRecCount = m_pStream->remainingSize();
+ }
+
+ //load draw object
+ for (unsigned short i = 0; i < nRecCount; i++)
+ {
+ XFFrame* pXFDrawObj = CreateDrawObject();
+
+ if (pXFDrawObj)
+ {
+ pDrawObjVector->push_back(pXFDrawObj);
+ }
+ }
+}
+
+/**
+ * @descr when we encounter a group object the function will be called to create a XF-drawgroup object
+ * the corresponding drawing objects.
+ * @param pDrawObjVector a container which will contains the created drawing object of XF-Model.
+ */
+XFDrawGroup* LwpSdwGroupLoaderV0102::CreateDrawGroupObject()
+{
+ //flag
+ unsigned char BinSignature[2];
+ m_pStream->ReadBytes(BinSignature, 2);
+ if (BinSignature[0] != 'S' || BinSignature[1] != 'M')
+ {
+ assert(false);
+ return nullptr;
+ }
+ //version
+ unsigned short nVersion;
+ m_pStream->ReadUInt16(nVersion);
+ if (nVersion<0x0102)
+ {
+ assert(false);
+ return nullptr;
+ }
+ // topObj, botObj
+ m_pStream->SeekRel(4);
+ //record count
+ unsigned short nRecCount(0);
+ m_pStream->ReadUInt16(nRecCount);
+ // selCount
+ m_pStream->SeekRel(2);
+ //boundrect
+ unsigned short left(0),top(0),right(0),bottom(0);
+ m_pStream->ReadUInt16(left);
+ m_pStream->ReadUInt16(top);
+ m_pStream->ReadUInt16(right);
+ m_pStream->ReadUInt16(bottom);
+ // fileSize
+ m_pStream->SeekRel(2);
+
+ XFDrawGroup* pXFDrawGroup = new XFDrawGroup();
+
+ if (nRecCount > m_pStream->remainingSize())
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ nRecCount = m_pStream->remainingSize();
+ }
+
+ //load draw object
+ for (unsigned short i = 0; i < nRecCount; i++)
+ {
+ XFFrame* pXFDrawObj = CreateDrawObject();
+
+ if (pXFDrawObj)
+ {
+ if (pXFDrawObj->GetFrameType() == enumXFFrameImage)
+ {
+ m_pDrawObjVector->push_back(pXFDrawObj);
+ }
+ else
+ {
+ pXFDrawGroup->Add(pXFDrawObj);
+ }
+ }
+ }
+
+ return pXFDrawGroup;
+}
+
+/**
+ * @descr Create the XF-drawing objects according to the object type read from bento stream.
+ * @return the created XF-drawing objects.
+ */
+XFFrame* LwpSdwGroupLoaderV0102::CreateDrawObject()
+{
+ //record type
+ unsigned char recType(0);
+ m_pStream->ReadUChar(recType);
+
+ std::unique_ptr<LwpDrawObj> pDrawObj;
+ XFFrame* pRetObjct = nullptr;
+
+ switch(recType)
+ {
+ case OT_PERPLINE://fall-through
+ case OT_LINE:
+ {
+ pDrawObj.reset(new LwpDrawLine(m_pStream, &m_aTransformData));
+ break;
+ }
+ case OT_POLYLINE:
+ {
+ pDrawObj.reset(new LwpDrawPolyLine(m_pStream, &m_aTransformData));
+ break;
+ }
+ case OT_POLYGON:
+ {
+ pDrawObj.reset(new LwpDrawPolygon(m_pStream, &m_aTransformData));
+ pDrawObj->SetObjectType(OT_POLYGON);
+ break;
+ }
+ case OT_SQUARE://fall-through
+ case OT_RECT:
+ {
+ pDrawObj.reset(new LwpDrawRectangle(m_pStream, &m_aTransformData));
+ break;
+ }
+ case OT_RNDSQUARE://fall-through
+ case OT_RNDRECT:
+ {
+ pDrawObj.reset(new LwpDrawRectangle(m_pStream, &m_aTransformData));
+ pDrawObj->SetObjectType(OT_RNDRECT);
+ break;
+ }
+ case OT_CIRCLE://fall-through
+ case OT_OVAL:
+ {
+ pDrawObj.reset(new LwpDrawEllipse(m_pStream, &m_aTransformData));
+ break;
+ }
+ case OT_ARC:
+ {
+ pDrawObj.reset(new LwpDrawArc(m_pStream, &m_aTransformData));
+ break;
+ }
+ case OT_TEXT:
+ {
+ pDrawObj.reset(new LwpDrawTextBox(m_pStream));
+ break;
+ }
+ case OT_TEXTART:
+ {
+ pDrawObj.reset(new LwpDrawTextArt(m_pStream, &m_aTransformData));
+ pDrawObj->SetObjectType(OT_TEXTART);
+ break;
+ }
+ case OT_GROUP:
+ {
+ m_pStream->SeekRel(2);
+ // read out the object header
+ pDrawObj.reset(new LwpDrawGroup(m_pStream));
+
+ pRetObjct = CreateDrawGroupObject();
+
+ // set anchor type
+ pRetObjct->SetAnchorType(enumXFAnchorFrame);
+ break;
+ }
+ case OT_CHART://fall-through
+ case OT_METAFILE://fall-through
+ case OT_METAFILEIMG:
+ {
+ LwpDrawMetafile aMeta(m_pStream);
+ break;
+ }
+ case OT_BITMAP:
+ pDrawObj.reset(new LwpDrawBitmap(m_pStream));
+ pDrawObj->SetObjectType(OT_BITMAP);
+ break;
+ }
+
+ // we don't need create the corresponding XF-object of a group object.
+ if (pDrawObj && recType != OT_GROUP)
+ {
+ pRetObjct = pDrawObj->CreateXFDrawObject();
+ }
+
+ return pRetObjct;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx
new file mode 100644
index 000000000..6bcf4892a
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWGROUPLOADERV0102_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWGROUPLOADERV0102_HXX
+
+#include <sal/config.h>
+#include <config_lgpl.h>
+
+#include <rtl/ref.hxx>
+
+#include "lwpsdwdrawheader.hxx"
+
+class SvStream;
+class XFFrame;
+class XFDrawGroup;
+class LwpGraphicObject;
+class LwpSdwGroupLoaderV0102
+{
+private:
+ SvStream* m_pStream;
+ LwpGraphicObject* m_pGraphicObj;
+ std::vector<rtl::Reference<XFFrame>>* m_pDrawObjVector;
+
+ DrawingOffsetAndScale m_aTransformData;
+
+public:
+ LwpSdwGroupLoaderV0102(SvStream* pStream, LwpGraphicObject* pGraphicObj);
+ ~LwpSdwGroupLoaderV0102();
+
+public:
+ void BeginDrawObjects(std::vector<rtl::Reference<XFFrame>>* pDrawObjVector);
+ XFDrawGroup* CreateDrawGroupObject();
+ XFFrame* CreateDrawObject();
+};
+
+#endif // INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWGROUPLOADERV0102_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwrect.cxx b/lotuswordpro/source/filter/lwpsdwrect.cxx
new file mode 100644
index 000000000..353d8dd38
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwrect.cxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype
+ * Implementation file of SdwRectangle.
+ */
+
+#include "lwpsdwrect.hxx"
+#include <cmath>
+
+/**************************************************************************
+ * @short: Default constructor
+**************************************************************************/
+SdwRectangle::SdwRectangle()
+ : m_bRotated(false)
+ // m_nRectCorner array fields are default initialized with Point()
+{
+}
+/**************************************************************************
+ * @short: Constructor
+ * @param: aPt0~aPt3 four corner points of a rectangle.
+**************************************************************************/
+SdwRectangle::SdwRectangle(const Point& rPt0, const Point& rPt1,
+ const Point& rPt2, const Point& rPt3)
+ : m_bRotated(rPt0.Y() != rPt1.Y() || rPt0.Y() >= rPt3.Y())
+ , m_nRectCorner({{rPt0, rPt1, rPt2, rPt3}})
+{
+}
+
+/**************************************************************************
+ * @short: Calculate and return center point of the rectangle.
+ * @return: center point
+**************************************************************************/
+Point SdwRectangle::GetRectCenter() const
+{
+ long nX = static_cast<long>(static_cast<double>(m_nRectCorner[0].X() + m_nRectCorner[2].X())/2 + 0.5);
+ long nY = static_cast<long>(static_cast<double>(m_nRectCorner[0].Y() + m_nRectCorner[2].Y())/2 + 0.5);
+
+ return Point(nX, nY);
+}
+/**************************************************************************
+ * @short: Calculate width of the rectangle.
+ * @return: rectangle width.
+**************************************************************************/
+long SdwRectangle::GetWidth() const
+{
+ long nX0 = m_nRectCorner[0].X();
+ long nY0 = m_nRectCorner[0].Y();
+ long nX1 = m_nRectCorner[1].X();
+ long nY1 = m_nRectCorner[1].Y();
+
+ return static_cast<long>(CalcDistBetween2Points(nX0, nY0, nX1, nY1));
+}
+/**************************************************************************
+ * @short: Calculate height of the rectangle.
+ * @return: rectangle height.
+**************************************************************************/
+long SdwRectangle::GetHeight() const
+{
+ long nX1 = m_nRectCorner[1].X();
+ long nY1 = m_nRectCorner[1].Y();
+ long nX2 = m_nRectCorner[2].X();
+ long nY2 = m_nRectCorner[2].Y();
+
+ return static_cast<long>(CalcDistBetween2Points(nX1, nY1, nX2, nY2));
+}
+/**************************************************************************
+ * @short: Calculate coordinate of the original rectangle.
+ * @return: a prz rectangle
+**************************************************************************/
+tools::Rectangle SdwRectangle::GetOriginalRect() const
+{
+ if (m_bRotated)
+ {
+ long nHeight = GetHeight();
+ long nWidth = GetWidth();
+ Point aCenter = GetRectCenter();
+
+ Point aLT(aCenter.X()-static_cast<long>(static_cast<double>(nWidth)/2+0.5),
+ aCenter.Y()-static_cast<long>(static_cast<double>(nHeight)/2+0.5));
+ Point aRB(aLT.X()+nWidth, aLT.Y()+nHeight);
+
+ return tools::Rectangle(aLT, aRB);
+ }
+ else
+ {
+ return tools::Rectangle(m_nRectCorner[3], m_nRectCorner[1]);
+ }
+}
+/**************************************************************************
+ * @short: Calculate rotation angle of the rectangle.
+ * @return: rotation angle.
+**************************************************************************/
+double SdwRectangle::GetRotationAngle() const
+{
+ if (!m_bRotated)
+ {
+ return 0.00;
+ }
+
+ double fX1 = static_cast<double>(m_nRectCorner[1].X());
+ double fY1 = static_cast<double>(m_nRectCorner[1].Y());
+ double fX2 = static_cast<double>(m_nRectCorner[2].X());
+ double fY2 = static_cast<double>(m_nRectCorner[2].Y());
+ double fMidX = (fX1 + fX2) / 2;
+ double fMidY = (fY1 + fY2) / 2;
+
+ Point aCenter = GetRectCenter();
+ double fCenterX = static_cast<double>(aCenter.X());
+ double fCenterY = static_cast<double>(aCenter.Y());
+
+ double fAngle = atan2((fMidY - fCenterY), (fMidX - fCenterX));
+
+ return -fAngle;
+}
+
+double SdwRectangle::CalcDistBetween2Points(long nX1, long nY1, long nX2, long nY2)
+{
+ return sqrt(static_cast<double>((nX1-nX2)*(nX1-nX2) + (nY1-nY2)*(nY1-nY2)));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsdwrect.hxx b/lotuswordpro/source/filter/lwpsdwrect.hxx
new file mode 100644
index 000000000..4aefb6a09
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsdwrect.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype
+ * Implementation file of SdwRectangle.
+ */
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWRECT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSDWRECT_HXX
+
+#include <config_lgpl.h>
+#include <tools/gen.hxx>
+#include <array>
+
+/**
+ * @brief
+ * SdwRectangle: Not like rectangle in SODC, rectangles in Word Pro are
+ * defined by 4 points. So they can be any posture in the two-dimensional
+ * coordinate system. The class is used to describe such rectangles.
+ * The four corner points must be saved in member variable:m_nRectCorner
+ * one after another. We assume the input order(the same order in .lwp files)
+ * is as below:
+ *
+ * y ^ m_nRectCorner[3] m_nRectCorner[2]
+ * | |--------------------|
+ * | | |
+ * | | |
+ * | |--------------------|
+ * | m_nRectCorner[0] m_nRectCorner[1]
+ * |
+ * |------------------------------------------------------->
+ * (0,0) x
+ *
+ */
+class SdwRectangle
+{
+private:
+ bool m_bRotated;
+
+public:
+ std::array<Point, 4> m_nRectCorner;
+
+public:
+ SdwRectangle();
+
+ SdwRectangle(const Point& rPt0, const Point& rPt1, const Point& rPt2, const Point& rPt3);
+
+public:
+ /*
+ * @short: Get the flag whether if the rectangle has been rotated.
+ * @return: m_bRotated rotation flag.
+ */
+ bool IsRectRotated() const { return m_bRotated; }
+
+ Point GetRectCenter() const;
+
+ long GetWidth() const;
+
+ long GetHeight() const;
+
+ tools::Rectangle GetOriginalRect() const;
+
+ double GetRotationAngle() const;
+
+ static double CalcDistBetween2Points(long nX1, long nY1, long nX2, long nY2);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsection.cxx b/lotuswordpro/source/filter/lwpsection.cxx
new file mode 100644
index 000000000..864f7e1f5
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsection.cxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwpcolor.hxx>
+#include <lwpatomholder.hxx>
+#include "lwplayout.hxx"
+#include "lwpdlvlist.hxx"
+#include <lwpobj.hxx>
+#include "lwpsection.hxx"
+#include <xfilter/xfsection.hxx>
+
+LwpOrderedObject::LwpOrderedObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLNFVList(objHdr, pStrm)
+{}
+
+/**
+ * @descr: read object information
+ *
+ */
+void LwpOrderedObject::Read()
+{
+ LwpDLNFVList::Read();
+
+ m_ListList.ReadIndexed(m_pObjStrm.get());
+ m_Para.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+LwpSection::LwpSection(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpOrderedObject(objHdr, pStrm)
+ , m_Flags(0)
+{}
+
+LwpSection::~LwpSection()
+{
+
+}
+
+/**
+ * @descr: read object information
+ *
+ */
+void LwpSection::Read()
+{
+ LwpOrderedObject::Read();
+ m_Flags = m_pObjStrm->QuickReaduInt16();
+ m_PageLayout.ReadIndexed(m_pObjStrm.get());
+ m_Color.Read(m_pObjStrm.get());
+ m_AtomHolder.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @descr: do nothing
+ *
+ */
+void LwpSection::Parse(IXFStream * /*pOutputStream*/)
+{
+
+}
+
+LwpIndexSection::LwpIndexSection(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
+ : LwpSection(objHdr, pStrm)
+ , m_nForm(0)
+ , m_nFlags(0)
+{}
+
+LwpIndexSection::~LwpIndexSection()
+{
+}
+
+/**
+ * @descr: read object information
+ *
+ */
+void LwpIndexSection::Read()
+{
+ LwpSection::Read();
+ m_TextMarker.Read(m_pObjStrm.get());
+ m_ParentName.Read(m_pObjStrm.get());
+ m_DivisionName.Read(m_pObjStrm.get());
+ m_SectionName.Read(m_pObjStrm.get());
+ m_nForm = m_pObjStrm->QuickReaduInt16();
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ m_pObjStrm->SkipExtra();
+}
+
+bool LwpIndexSection::IsFormatRunin() const
+{
+ return (m_nFlags & RUN_IN) != 0;
+
+}
+
+bool LwpIndexSection::IsFormatSeparator() const
+{
+ return (m_nFlags & SEPARATORS) != 0;
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsection.hxx b/lotuswordpro/source/filter/lwpsection.hxx
new file mode 100644
index 000000000..a3678fb0e
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsection.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSECTION_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSECTION_HXX
+#include "lwppagelayout.hxx"
+
+/**
+ * @brief COrderedObject class in .lwp file
+ *
+ */
+class LwpDLNFVList;
+class LwpOrderedObject : public LwpDLNFVList
+{
+public:
+ LwpOrderedObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ LwpObjectID& GetPosition(){ return m_Para;}
+ LwpObjectID& GetListList(){ return m_ListList;}
+private:
+ LwpObjectID m_ListList;//lwplistlist object,
+ LwpObjectID m_Para;
+};
+
+/**
+ * @brief VO_SECTION object in .lwp file
+ *
+ */
+class LwpColor;
+class LwpAtomHolder;
+class LwpSection : public LwpOrderedObject
+{
+public:
+ LwpSection(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpSection() override;
+ inline LwpPageLayout* GetPageLayout();
+ void Parse(IXFStream* pOutputStream) override;
+ OUString const & GetSectionName() const {return m_AtomHolder.str();}
+
+protected:
+ void Read() override;
+private:
+ sal_uInt16 m_Flags;
+ LwpObjectID m_PageLayout;
+ LwpColor m_Color;
+ LwpAtomHolder m_AtomHolder;
+
+};
+
+/**
+ * @descr Get page layout pointer
+ *
+ */
+inline LwpPageLayout* LwpSection::GetPageLayout()
+{
+ return dynamic_cast<LwpPageLayout*>(m_PageLayout.obj().get());
+}
+
+class LwpIndexSection : public LwpSection
+{
+public:
+ LwpIndexSection(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpIndexSection() override;
+ bool IsFormatRunin() const;
+ bool IsFormatSeparator() const;
+protected:
+ void Read() override;
+private:
+ enum{
+ SEPARATORS = 0x01,
+ RUN_IN = 0X02,
+ };
+ LwpAtomHolder m_TextMarker;
+ LwpAtomHolder m_ParentName;
+ LwpAtomHolder m_DivisionName;
+ LwpAtomHolder m_SectionName;
+ sal_uInt16 m_nForm;
+ sal_uInt16 m_nFlags;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpshadow.hxx b/lotuswordpro/source/filter/lwpshadow.hxx
new file mode 100644
index 000000000..7e38f78b2
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpshadow.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSHADOW_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSHADOW_HXX
+
+#include <lwpcolor.hxx>
+#include <lwptools.hxx>
+
+class LwpShadow
+{
+public:
+ LwpShadow():m_nDirX(0),m_nDirY(0){}
+public:
+ void Read(LwpObjectStream *pStrm)
+ {
+ m_aColor.Read(pStrm);
+ m_nDirX = pStrm->QuickReadInt32();
+ m_nDirY = pStrm->QuickReadInt32();
+ pStrm->SkipExtra();
+ }
+
+ double GetOffsetX();
+
+ double GetOffsetY();
+
+ const LwpColor& GetColor() const;
+
+private:
+ LwpColor m_aColor;
+ sal_Int32 m_nDirX;
+ sal_Int32 m_nDirY;
+};
+
+inline double LwpShadow::GetOffsetX()
+{
+ // return 0.102;
+ return LwpTools::ConvertFromUnitsToMetric(m_nDirX);
+}
+
+inline double LwpShadow::GetOffsetY()
+{
+ return LwpTools::ConvertFromUnitsToMetric(m_nDirY);
+}
+
+inline const LwpColor& LwpShadow::GetColor() const
+{
+ return m_aColor;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx
new file mode 100644
index 000000000..d13371158
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx
@@ -0,0 +1,448 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <memory>
+#include <lwpglobalmgr.hxx>
+#include "lwpsilverbullet.hxx"
+#include "lwpdoc.hxx"
+#include "lwpdivinfo.hxx"
+#include "lwpfribheader.hxx"
+#include <lwpfoundry.hxx>
+#include "lwpstory.hxx"
+#include "lwppara.hxx"
+#include <xfilter/xfliststyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+
+LwpSilverBullet::LwpSilverBullet(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpDLNFVList(objHdr, pStrm)
+ , m_nFlags(0)
+ , m_nUseCount(0)
+ , m_pAtomHolder(new LwpAtomHolder)
+{
+}
+
+LwpSilverBullet::~LwpSilverBullet()
+{
+}
+
+void LwpSilverBullet::Read()
+{
+ LwpDLNFVList::Read();
+
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ m_aStory.ReadIndexed(m_pObjStrm.get());
+
+ sal_uInt16 nNumPos = m_pObjStrm->QuickReaduInt16();
+
+ if (nNumPos > SAL_N_ELEMENTS(m_pResetPositionFlags))
+ throw std::range_error("corrupt SilverBullet");
+
+ for (sal_uInt16 nC = 0; nC < nNumPos; nC++)
+ m_pResetPositionFlags[nC] = m_pObjStrm->QuickReaduInt8();
+
+ m_nUseCount = m_pObjStrm->QuickReaduInt32();
+
+ m_pAtomHolder->Read(m_pObjStrm.get());
+}
+
+/**
+ * @short: Register bullet or numbering style-list and store the returned
+ * name from XFStyleManager.
+ * @descr:
+ */
+void LwpSilverBullet::RegisterStyle()
+{
+ std::unique_ptr<XFListStyle> xListStyle(new XFListStyle());
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+
+ GetBulletPara();
+
+ if (IsBulletOrdered() && HasName())
+ {
+ //todo: find the flag in the file
+ bool bCumulative = false;
+
+ for (sal_uInt8 nPos = 1; nPos < 10; nPos++)
+ {
+ ParaNumbering aParaNumbering;
+ //get numbering format according to the position.
+ m_xBulletPara->GetParaNumber(nPos, &aParaNumbering);
+ LwpFribParaNumber* pParaNumber = aParaNumbering.pParaNumber;
+ if (pParaNumber)
+ {
+ if (pParaNumber->GetStyleID() != NUMCHAR_other)
+ {
+ m_pHideLevels[nPos] = aParaNumbering.nNumLevel;
+ sal_uInt16 nDisplayLevel = GetDisplayLevel(nPos);
+ bCumulative = (nDisplayLevel > 1);
+ OUString aPrefix = GetAdditionalName(nPos);
+
+ XFNumFmt aFmt;
+ if (!bCumulative && aParaNumbering.pPrefix)
+ {
+ aFmt.SetPrefix(aPrefix + aParaNumbering.pPrefix->GetText());
+ }
+
+ aFmt.SetFormat(GetNumCharByStyleID(pParaNumber));
+
+ if (aParaNumbering.pSuffix)
+ {
+ aFmt.SetSuffix(aParaNumbering.pSuffix->GetText());
+ }
+
+ //set numbering format into the style-list.
+ xListStyle->SetListNumber(nPos, aFmt, pParaNumber->GetStart()+1);
+
+ if (bCumulative && nPos > 1)
+ {
+ xListStyle->SetDisplayLevel(nPos, nDisplayLevel);
+ }
+
+ }
+ else
+ {
+ OUString aPrefix, aSuffix;
+ if (aParaNumbering.pPrefix)
+ {
+ aPrefix = aParaNumbering.pPrefix->GetText();
+ }
+ if (aParaNumbering.pSuffix)
+ {
+ aSuffix = aParaNumbering.pSuffix->GetText();
+ }
+
+ xListStyle->SetListBullet(nPos, GetNumCharByStyleID(pParaNumber),
+ "Times New Roman", aPrefix, aSuffix);
+ }
+
+ xListStyle->SetListPosition(nPos, 0.0, 0.635, 0.0);
+ aParaNumbering.clear();
+ }
+ }
+ }
+
+ //add style-list to style manager.
+ m_strStyleName = pXFStyleManager->AddStyle(std::move(xListStyle)).m_pStyle->GetStyleName();
+}
+
+/**
+ * @short: Get the font name of the bullet.
+ * @descr:
+ * @return: Font name of the bullet.
+ */
+OUString LwpSilverBullet::GetBulletFontName()
+{
+ //foundry has been set?
+ if (!m_pFoundry)
+ {
+ return OUString();
+ }
+
+ LwpFontManager& rFontMgr = m_pFoundry->GetFontManger();
+
+ sal_uInt32 nBulletFontID = m_xBulletPara->GetBulletFontID();
+ sal_uInt16 nFinalFont = static_cast<sal_uInt16>((nBulletFontID >> 16) & 0xFFFF);
+
+ //final fontid is valid?
+ if (nFinalFont > 255 || nFinalFont == 0)
+ {
+ return OUString();
+ }
+
+ //get font name from font manager.
+ OUString aFontName = rFontMgr.GetNameByID(nBulletFontID);
+
+ return aFontName;
+}
+/**
+ * @short: Get bullet character of the bullet vo_para.
+ * @descr:
+ * @return: An UChar32 bullet character.
+ */
+OUString const & LwpSilverBullet::GetBulletChar() const
+{
+ return m_xBulletPara->GetBulletChar();
+}
+
+/**
+ * @short: Get the LwpPara object through story id.
+ */
+LwpPara* LwpSilverBullet::GetBulletPara()
+{
+ if (!m_xBulletPara.is())
+ {
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY).get());
+ if (!pStory)
+ {
+ return nullptr;
+ }
+
+ m_xBulletPara.set(dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj(VO_PARA).get()));
+ }
+
+ return m_xBulletPara.get();
+}
+
+/**
+ * @short: Get numbering character of the bullet vo_para.
+ * @descr:
+ * @param: pParaNumber a pointer to the structure LwpFribParaNumber which
+ * includes numbering prefix, format and suffix.
+ * @return: An OUString object which store the numbering character.
+ */
+OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber const * pParaNumber)
+{
+ if (!pParaNumber)
+ {
+ assert(false);
+ return OUString();
+ }
+
+ OUString strNumChar("1");
+ sal_uInt16 nStyleID = pParaNumber->GetStyleID();
+
+ switch (nStyleID)
+ {
+ case NUMCHAR_1:
+ case NUMCHAR_01:
+ case NUMCHAR_Chinese4:
+ strNumChar = "1";
+ break;
+ case NUMCHAR_A :
+ strNumChar = "A";
+ break;
+ case NUMCHAR_a:
+ strNumChar = "a";
+ break;
+ case NUMCHAR_I:
+ strNumChar = "I";
+ break;
+ case NUMCHAR_i:
+ strNumChar = "i";
+ break;
+ case NUMCHAR_other:
+ strNumChar = OUString(sal_Unicode(pParaNumber->GetNumberChar()));
+ break;
+ case NUMCHAR_Chinese1:
+ {
+ sal_Unicode const sBuf[13] = {0x58f9,0x002c,0x0020,0x8d30,0x002c,0x0020,0x53c1,0x002c,0x0020,0x002e,0x002e,0x002e,0x0};
+ strNumChar = OUString(sBuf);
+ }
+ break;
+ case NUMCHAR_Chinese2:
+ {
+ sal_Unicode const sBuf[13] = {0x4e00,0x002c,0x0020,0x4e8c,0x002c,0x0020,0x4e09,0x002c,0x0020,0x002e,0x002e,0x002e,0x0};
+ strNumChar = OUString(sBuf);
+ }
+ break;
+ case NUMCHAR_Chinese3:
+ {
+ sal_Unicode const sBuf[13] = {0x7532,0x002c,0x0020,0x4e59,0x002c,0x0020,0x4e19,0x002c,0x0020,0x002e,0x002e,0x002e,0x0};
+ strNumChar = OUString(sBuf);
+ }
+ break;
+ case NUMCHAR_none:
+ strNumChar.clear();
+ break;
+ default:
+ break;
+ }//mod end
+ return strNumChar;
+}
+
+/**
+ * @short: To judge the silverbullet list is ordered or not.
+ * @descr:
+ * @return: sal_True if list is ordered, sal_False if list is unordered.
+ */
+bool LwpSilverBullet::IsBulletOrdered()
+{
+ if (!m_xBulletPara.is())
+ return false;
+
+ LwpFribPtr& rFribs = m_xBulletPara->GetFribs();
+
+ return (rFribs.HasFrib(FRIB_TAG_PARANUMBER) != nullptr);
+}
+
+/**
+ * @short: Calculate the displaylevel according to the position and hidelevels.
+ * @descr:
+ * @param: nPos position of the numbering.
+ * @return: displaylevel of the position passed in.
+ */
+sal_uInt16 LwpSilverBullet::GetDisplayLevel(sal_uInt8 nPos)
+{
+ if (nPos > 1)
+ {
+ sal_uInt16 nHideBit = (1 << nPos);
+ for (sal_uInt8 nC = nPos-1; nC > 0; nC--)
+ {
+ sal_uInt16 nAttrMask = ~m_pHideLevels[nC];
+ if (!(nAttrMask & nHideBit))
+ {
+ return static_cast<sal_uInt16>(nPos - nC);
+ }
+ }
+ }
+
+ return static_cast<sal_uInt16>(nPos);
+}
+
+/**
+ * @descr: Get the additional information, "Division name" or "Section Name" from document
+ * variable frib according to numbering position. Whether we should add a
+ * Division/Section name or not is determined by the hidelevels of the frib.
+ * @param: nPos position of the numbering.
+ * @return: Division or Section name.
+ */
+OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos)
+{
+ OUString aRet;
+ sal_uInt16 nHideBit = (1 << nPos);
+ bool bDivisionName = false;
+ bool bSectionName = false;
+
+ LwpFrib* pParaFrib = m_xBulletPara->GetFribs().GetFribs();
+ if (!pParaFrib)
+ {
+ return OUString();
+ }
+
+ while (pParaFrib)
+ {
+ if (pParaFrib->GetType() == FRIB_TAG_DOCVAR)
+ {
+ ModifierInfo* pMoInfo = pParaFrib->GetModifiers();
+ if (!pMoInfo)
+ {
+ return OUString();
+ }
+ sal_uInt16 nHideLevels = pMoInfo->aTxtAttrOverride.GetHideLevels();
+ sal_uInt16 nType = static_cast<LwpFribDocVar*>(pParaFrib)->GetType();
+
+ if (~nHideLevels & nHideBit)
+ {
+ if (nType == 0x000D)
+ {
+ bDivisionName = true;
+ }
+ else if (nType == 0x000E)
+ {
+ bSectionName= true;
+ }
+ }
+ }
+ pParaFrib = pParaFrib->GetNext();
+ }
+
+ if (bDivisionName)
+ {
+ aRet += GetDivisionName();
+ }
+ if (bSectionName)
+ {
+ aRet += GetSectionName();
+ }
+
+ return aRet;
+}
+
+OUString LwpSilverBullet::GetDivisionName()
+{
+ OUString aRet;
+
+ if (!m_pFoundry)
+ {
+ return aRet;
+ }
+
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ if (pDoc)
+ {
+ LwpObjectID& rID = pDoc->GetDivInfoID();
+ if (!rID.IsNull())
+ {
+ LwpDivInfo *pInfo = dynamic_cast<LwpDivInfo*>(rID.obj(VO_DIVISIONINFO).get());
+ if (pInfo)
+ aRet = pInfo->GetDivName();
+ }
+ }
+
+ return aRet;
+}
+
+OUString LwpSilverBullet::GetSectionName() const
+{
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY).get());
+ if (!pStory)
+ {
+ return OUString();
+ }
+
+ return pStory->GetSectionName();
+}
+
+bool LwpSilverBullet::HasName()
+{
+ LwpAtomHolder& rName = GetName();
+ return (!rName.str().isEmpty());
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.hxx b/lotuswordpro/source/filter/lwpsilverbullet.hxx
new file mode 100644
index 000000000..2b56805bf
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsilverbullet.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSILVERBULLET_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSILVERBULLET_HXX
+
+#include <config_lgpl.h>
+#include <memory>
+#include "lwpdlvlist.hxx"
+#include <lwpobjid.hxx>
+#include <lwpatomholder.hxx>
+
+const sal_uInt16 MAXNUMBERPOSITIONS = 10; //max number of positions
+const sal_uInt16 NUMCHAR_none = 0x00; //none of numberchar
+const sal_uInt16 NUMCHAR_1 = 0x01; //index for numberchar "1"
+const sal_uInt16 NUMCHAR_A = 0x02; //index for numberchar "A"
+const sal_uInt16 NUMCHAR_a = 0x03; //index for numberchar "a"
+const sal_uInt16 NUMCHAR_I = 0x04; //index for numberchar "I"
+const sal_uInt16 NUMCHAR_i = 0x05; //index for numberchar "i"
+const sal_uInt16 NUMCHAR_other= 0x06; //index for numberchar "other"
+const sal_uInt16 NUMCHAR_01 = 0x0B; //index for numberchar "01"
+
+const sal_uInt16 NUMCHAR_Chinese1 = 0x09; //index for numberchar "Ò¼"
+const sal_uInt16 NUMCHAR_Chinese2 = 0x08; //index for numberchar "Ò»"
+const sal_uInt16 NUMCHAR_Chinese3= 0x0A; //index for numberchar "¼×"
+const sal_uInt16 NUMCHAR_Chinese4 = 0x13; //index for numberchar "01" in chinese version
+
+class LwpAtomHolder;
+class LwpPara;
+class LwpFribParaNumber;
+
+class LwpSilverBullet : public LwpDLNFVList
+{
+public:
+ LwpSilverBullet(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
+
+ virtual ~LwpSilverBullet() override;
+
+ virtual void RegisterStyle() override;
+
+ void Read() override;
+
+ bool IsBulletOrdered();
+
+ OUString GetBulletFontName();
+
+ const OUString& GetBulletStyleName() const;
+
+ OUString const & GetBulletChar() const;
+
+ static OUString GetPrefix() { return OUString(); }
+
+ static OUString GetSuffix() { return OUString(); }
+
+ bool HasName();
+
+ static OUString GetNumCharByStyleID(LwpFribParaNumber const * pParaNumber);
+
+ inline bool IsLesserLevel(sal_uInt16 nPos);
+
+ LwpPara* GetBulletPara();
+
+ sal_uInt16 GetDisplayLevel(sal_uInt8 nPos);
+
+ OUString GetAdditionalName(sal_uInt8 nPos);
+
+ OUString GetDivisionName();
+
+ OUString GetSectionName() const;
+
+private:
+ sal_uInt16 m_nFlags;
+ LwpObjectID m_aStory;
+ sal_uInt8 m_pResetPositionFlags[MAXNUMBERPOSITIONS];
+ sal_uInt32 m_nUseCount;
+ std::unique_ptr<LwpAtomHolder> m_pAtomHolder;
+
+ rtl::Reference<LwpPara> m_xBulletPara;
+ OUString m_strStyleName;
+ sal_uInt16 m_pHideLevels[10];
+
+private:
+ enum // For m_pResetPositionFlags
+ {
+ LESSERLEVEL = 0x01,
+ LESSERSPECIFIC = 0x02,
+ NEWDIVISION = 0x04,
+ NEWSECTION = 0x08,
+ CUMULATIVE = 0x10
+ };
+};
+inline const OUString& LwpSilverBullet::GetBulletStyleName() const
+{
+ return m_strStyleName;
+}
+inline bool LwpSilverBullet::IsLesserLevel(sal_uInt16 nPos)
+{
+ if (nPos < SAL_N_ELEMENTS(m_pResetPositionFlags))
+ return ((m_pResetPositionFlags[nPos] & LESSERLEVEL) != 0);
+ return false;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsortopt.cxx b/lotuswordpro/source/filter/lwpsortopt.cxx
new file mode 100644
index 000000000..790eebb88
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsortopt.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpsortopt.hxx"
+
+void LwpSortKey::Read(LwpObjectStream *pStrm)
+{
+ m_nField = pStrm->QuickReaduInt16();
+ m_nFlag = pStrm->QuickReaduInt16();
+ m_nWord = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+LwpSortOption::LwpSortOption(LwpObjectStream* pStrm)
+{
+ Read(pStrm);
+}
+/**
+ * @descr Read sort option in VO_DOCUMENT from object stream
+ **/
+void LwpSortOption::Read(LwpObjectStream *pStrm)
+{
+ m_nCount = pStrm->QuickReaduInt16();
+ m_nFlags = pStrm->QuickReaduInt16();
+ m_nText = pStrm->QuickReaduInt8();
+ for(LwpSortKey & key : m_Keys)
+ {
+ key.Read(pStrm);
+ }
+ pStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsortopt.hxx b/lotuswordpro/source/filter/lwpsortopt.hxx
new file mode 100644
index 000000000..4c0b94aa1
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsortopt.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSORTOPT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSORTOPT_HXX
+
+#include <config_lgpl.h>
+
+#include <lwpobjstrm.hxx>
+
+/**
+ * @brief sort key class for LwpSortOption
+*/
+class LwpSortKey
+{
+private:
+ sal_uInt16 m_nField;
+ sal_uInt16 m_nFlag;
+ sal_uInt16 m_nWord;
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+/**
+ * @brief sort options in VO_DOCUMENT
+ * only for read, not parsed now
+*/
+class LwpSortOption
+{
+public:
+ explicit LwpSortOption(LwpObjectStream* pStrm);
+public:
+ void Read(LwpObjectStream *pStrm);
+private:
+ LwpSortKey m_Keys[3];
+ sal_uInt16 m_nCount;
+ sal_uInt16 m_nFlags;
+ sal_uInt8 m_nText;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
new file mode 100644
index 000000000..0b15e79a6
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -0,0 +1,475 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * LwpStory:
+ 1. Word Pro object for paragraph list;
+ 2. the content of layout object
+ ************************************************************************/
+
+#include <lwpglobalmgr.hxx>
+#include "lwpstory.hxx"
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include "lwppara.hxx"
+#include <lwpobjfactory.hxx>
+#include "lwppagelayout.hxx"
+#include <rtl/ustrbuf.hxx>
+
+#include <algorithm>
+#include <o3tl/sorted_vector.hxx>
+
+
+LwpStory::LwpStory(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpContent(objHdr, pStrm)
+ , m_bPMModified(false)
+ , m_pCurrentLayout(nullptr)
+ , m_pTabLayout(nullptr)
+ , m_bDropcap(false)
+ , m_pHyperlinkMgr(new LwpHyperlinkMgr)
+{
+}
+
+LwpStory::~LwpStory()
+{
+}
+
+void LwpStory::Read()
+{
+ LwpContent::Read();
+ m_ParaList.Read(m_pObjStrm.get());
+ m_FirstParaStyle.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+/**************************************************************************
+ * @descr: Convert all the contents in current story
+**************************************************************************/
+void LwpStory::XFConvert(XFContentContainer* pCont)
+{
+ //process frame which anchor frame
+ XFConvertFrameInFrame(pCont);
+ //process para list
+ XFContentContainer* pParaCont = pCont;
+ rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+ o3tl::sorted_vector<LwpPara*> aConverted;
+ while (xPara.is())
+ {
+ xPara->SetFoundry(m_pFoundry);
+ xPara->XFConvert(pParaCont);
+ aConverted.insert(xPara.get());
+
+ //Get the xfcontainer for the next para
+ pParaCont = xPara->GetXFContainer();
+ rtl::Reference<LwpPara> xNext(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get()));
+ if (aConverted.find(xNext.get()) != aConverted.end())
+ throw std::runtime_error("loop in conversion");
+ xPara = xNext;
+ }
+
+ //process frame which anchor is to cell after converter all the para
+ XFConvertFrameInCell(pCont);
+ XFConvertFrameInHeaderFooter(pCont);
+
+ //Release Lwp Objects
+ rtl::Reference<LwpPara> xCur(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+ rtl::Reference<LwpPara> xNext;
+ while (xCur.is())
+ {
+ xNext.set(dynamic_cast<LwpPara*>(xCur->GetNext().obj().get()));
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
+ pObjMgr->ReleaseObject(xCur->GetObjectID());
+ xCur = xNext;
+ }
+}
+
+void LwpStory::RegisterStyle()
+{
+ rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+ o3tl::sorted_vector<LwpPara*> aSeen;
+ while (xPara.is())
+ {
+ aSeen.insert(xPara.get());
+ xPara->SetFoundry(m_pFoundry);
+ xPara->DoRegisterStyle();
+ xPara.set(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get()));
+ if (aSeen.find(xPara.get()) != aSeen.end())
+ throw std::runtime_error("loop in register style");
+ }
+}
+
+void LwpStory::Parse(IXFStream* pOutputStream)
+{
+ m_xXFContainer.set(new XFContentContainer);
+ XFConvert(m_xXFContainer.get());
+ m_xXFContainer->ToXml(pOutputStream);
+ m_xXFContainer.clear();
+}
+
+/**************************************************************************
+ * @descr: Set current page layout. If pPageLayout is a mirror page layout,
+ use odd child page layout as current page layout.
+**************************************************************************/
+void LwpStory::SetCurrentLayout(LwpPageLayout *pPageLayout)
+{
+ LwpPageLayout* pLayout = pPageLayout->GetOddChildLayout();
+ if(pLayout)
+ {
+ m_pCurrentLayout = pLayout;
+ m_pTabLayout = pLayout;
+ }
+ else
+ {
+ m_pCurrentLayout = pPageLayout;
+ m_pTabLayout = pPageLayout;
+ }
+ m_bPMModified = true;
+}
+
+/**************************************************************************
+ * @descr: Get the next page layout relative to m_pCurrentLayout
+**************************************************************************/
+LwpPageLayout* LwpStory::GetNextPageLayout()
+{
+ std::vector<LwpPageLayout*>::iterator it = std::find(m_LayoutList.begin(), m_LayoutList.end(), m_pCurrentLayout);
+ if (it != m_LayoutList.end() && (it+1) != m_LayoutList.end())
+ return *(it+1);
+ return nullptr;
+}
+/**************************************************************************
+ * @descr: Sort the pagelayout according to their position
+**************************************************************************/
+void LwpStory::SortPageLayout()
+{
+ //Get all the pagelayout and store in list
+ std::vector<LwpPageLayout*> aLayoutList;
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout)
+ {
+ LwpPageLayout *pLayout = xLayout->IsPage()
+ ? dynamic_cast<LwpPageLayout*>(xLayout.get())
+ : nullptr;
+ if (pLayout)
+ {
+ LwpLayout::UseWhenType eSectionType = pLayout->GetUseWhenType();
+ //for mirror page, the child is pagelayout
+ rtl::Reference<LwpVirtualLayout> xParent = xLayout->GetParentLayout();
+ if(eSectionType != LwpLayout::StartWithinColume && xParent.is() && !xParent->IsPage())
+ {
+ aLayoutList.push_back(pLayout);
+ }
+ }
+ xLayout = GetLayout(xLayout.get());
+ }
+ // sort the pagelayout according to their position
+ if (!aLayoutList.empty())
+ {
+ for( std::vector<LwpPageLayout*>::iterator aIt = aLayoutList.begin(); aIt != aLayoutList.end() -1; ++aIt)
+ {
+ for( std::vector<LwpPageLayout*>::iterator bIt = aIt +1; bIt != aLayoutList.end(); ++bIt )
+ {
+ if(!(**aIt < **bIt))
+ {
+ std::swap(*aIt, *bIt);
+ }
+ }
+ }
+ }
+
+ //put all the sorted layouts into list
+ m_LayoutList.clear();
+
+ for (auto const& layout : aLayoutList)
+ {
+ m_LayoutList.push_back(layout);
+ }
+}
+
+/**************************************************************************
+ * @descr: whether need create a new section and reset column in current page layout
+**************************************************************************/
+bool LwpStory::IsNeedSection()
+{
+ bool bNewSection = false;
+ if(m_pCurrentLayout)
+ {
+ if(m_pCurrentLayout->HasColumns())
+ {
+ //get the following pagelayout and its type
+ bool bColumns = true;
+ LwpPageLayout* pNextLayout = GetNextPageLayout();
+ if(pNextLayout)
+ {
+ //get layout type
+ LwpLayout::UseWhenType eWhenType = pNextLayout->GetUseWhenType();
+ switch(eWhenType)
+ {
+ case LwpLayout::StartWithinColume://not support now
+ case LwpLayout::StartWithinPage:
+ {
+ bColumns =false;
+ bNewSection = true;
+ break;
+ }
+ case LwpLayout::StartOnNextPage:
+ case LwpLayout::StartOnOddPage://not support now
+ case LwpLayout::StartOnEvenPage://not support now
+ {
+ bColumns =true;
+ bNewSection = false;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ //if bColumns is true, the page layout doesn't need columns, set the xfcolumns to NULL in page master
+ if(!bColumns)
+ {
+ m_pCurrentLayout->ResetXFColumns();
+ }
+ }
+ SetPMModified(false);
+ }
+ return bNewSection;
+}
+/**************************************************************************
+ * @descr: process frame which anchor type is to cell
+**************************************************************************/
+void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
+{
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.is())
+ {
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ while (xFrameLayout.is())
+ {
+ if (xFrameLayout->IsAnchorCell() && xFrameLayout->HasContent())
+ {
+ //get the first xfpara
+ rtl::Reference<XFContent> first(
+ pCont->FindFirstContent(enumXFContentPara));
+ XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
+ if(pXFFirtPara)
+ xFrameLayout->DoXFConvert(pXFFirtPara);
+ }
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
+ }
+ xLayout = GetLayout(xLayout.get());
+ }
+}
+
+/**************************************************************************
+ * @descr: process frame which anchor type is to page
+**************************************************************************/
+void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
+{
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.is())
+ {
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
+ while (xFrameLayout.is())
+ {
+ aSeen.insert(xFrameLayout.get());
+ if( xFrameLayout->IsAnchorPage()
+ && (xFrameLayout->IsFrame()
+ || xFrameLayout->IsSuperTable()
+ || xFrameLayout->IsGroupHead()) )
+ {
+ xFrameLayout->DoXFConvert(pCont);
+ }
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
+ if (aSeen.find(xFrameLayout.get()) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ xLayout = GetLayout(xLayout.get());
+ }
+}
+/**************************************************************************
+ * @descr: process frame which anchor type is to frame
+**************************************************************************/
+void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont)
+{
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout)
+ {
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
+ while (xFrameLayout.is())
+ {
+ aSeen.insert(xFrameLayout.get());
+ if (xFrameLayout->IsAnchorFrame())
+ {
+ xFrameLayout->DoXFConvert(pCont);
+ }
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
+ if (aSeen.find(xFrameLayout.get()) != aSeen.end())
+ throw std::runtime_error("loop in register style");
+ }
+ xLayout = GetLayout(xLayout.get());
+ }
+}
+/**************************************************************************
+ * @descr: process frame which anchor type is to page and the frame is contained by header or footer
+**************************************************************************/
+void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
+{
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.is())
+ {
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ while (xFrameLayout.is())
+ {
+ if (xFrameLayout->IsAnchorPage() && (xLayout->IsHeader() || xLayout->IsFooter()))
+ {
+ //The frame must be included by <text:p>
+ rtl::Reference<XFContent> first(
+ pCont->FindFirstContent(enumXFContentPara));
+ XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
+ if(pXFFirtPara)
+ xFrameLayout->DoXFConvert(pXFFirtPara);
+ }
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
+ }
+ xLayout = GetLayout(xLayout.get());
+ }
+}
+
+void LwpStory::AddXFContent(XFContent* pContent)
+{
+ if (m_xXFContainer)
+ m_xXFContainer->Add(pContent);
+}
+
+XFContentContainer* LwpStory::GetXFContent()
+{
+ return m_xXFContainer.get();
+}
+
+LwpPara* LwpStory::GetLastParaOfPreviousStory()
+{
+ rtl::Reference<LwpVirtualLayout> xVLayout(GetLayout(nullptr));
+ if (xVLayout.is())
+ {
+ return xVLayout->GetLastParaOfPreviousStory();
+ }
+
+ return nullptr;
+}
+/**************************************************************************
+ * @descr: get text from story
+**************************************************************************/
+OUString LwpStory::GetContentText(bool bAllText)
+{
+ if (bAllText)//convert all text fribs
+ {
+ OUStringBuffer sText;
+ //process para list
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara().obj().get());
+ while (pPara)
+ {
+ pPara->SetFoundry(m_pFoundry);
+ sText.append(pPara->GetContentText(true));
+ pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
+ }
+ return sText.makeStringAndClear();
+ }
+ else //only the first text frib
+ {
+ rtl::Reference<LwpObject> pObj = GetFirstPara().obj();
+ if(pObj.is())
+ {
+ LwpPara* pPara = dynamic_cast<LwpPara*>(pObj.get());
+ if (!pPara || pPara->GetNext().obj() != nullptr)
+ return OUString();
+ pPara->SetFoundry(m_pFoundry);
+ return pPara->GetContentText();
+ }
+ return OUString();
+ }
+
+}
+OUString LwpStory::RegisterFirstFribStyle()
+{
+ LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara().obj().get());
+ if (!pPara)
+ return OUString();
+ pPara->SetFoundry(m_pFoundry);
+ LwpFribPtr& rFribs = pPara->GetFribs();
+ LwpFrib* pFirstFrib = rFribs.GetFribs();
+ pFirstFrib->RegisterStyle(m_pFoundry);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFTextStyle* pBaseStyle = pXFStyleManager->FindTextStyle(pFirstFrib->GetStyleName());
+ if (pBaseStyle == nullptr)
+ return OUString();
+ std::unique_ptr<XFTextStyle> pStyle(new XFTextStyle);
+ *pStyle = *pBaseStyle;
+ OUString sName = "Ruby" + pFirstFrib->GetStyleName();
+ pStyle->SetStyleName(sName);
+ pXFStyleManager->AddStyle(std::move(pStyle));
+ return sName;
+}
+
+bool LwpStory::IsBullStyleUsedBefore(const OUString& rStyleName, sal_uInt8 nPos)
+{
+ return std::any_of(m_vBulletStyleNameList.rbegin(), m_vBulletStyleNameList.rend(),
+ [&rStyleName, &nPos](const NamePosPair& rPair) { return rPair.first == rStyleName && rPair.second == nPos; });
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpstory.hxx b/lotuswordpro/source/filter/lwpstory.hxx
new file mode 100644
index 000000000..3c86e4857
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpstory.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * LwpStory:
+ 1. Word Pro object for paragraph list;
+ 2. the content of layout object
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSTORY_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSTORY_HXX
+
+#include <memory>
+#include "lwpcontent.hxx"
+#include "lwphyperlinkmgr.hxx"
+
+class LwpPageLayout;
+class LwpStory final : public LwpContent
+{
+public:
+ LwpStory(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpStory() override;
+private:
+ //File format members:
+ LwpDLVListHeadTail m_ParaList;
+ LwpObjectID m_FirstParaStyle;
+
+ // for bullet , 05/23/2005
+ typedef std::pair<OUString, sal_uInt8> NamePosPair;
+ std::vector <NamePosPair> m_vBulletStyleNameList;
+
+ // , 02/16/2005
+ bool m_bPMModified;
+ LwpPageLayout* m_pCurrentLayout; //for register page layout style
+ std::vector<LwpPageLayout*> m_LayoutList;
+ LwpLayout* m_pTabLayout; //for register tab style
+
+ bool m_bDropcap;
+ std::unique_ptr<LwpHyperlinkMgr> m_pHyperlinkMgr;
+ OUString m_CurrSectionName;
+
+ rtl::Reference<XFContentContainer> m_xXFContainer;
+
+ void Read() override;
+ void XFConvertFrameInCell(XFContentContainer* pCont);
+ void XFConvertFrameInFrame(XFContentContainer* pCont);
+ void XFConvertFrameInHeaderFooter(XFContentContainer* pCont);
+
+public:
+ void RegisterStyle() override;
+ void Parse(IXFStream* pOutputStream) override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ void XFConvertFrameInPage(XFContentContainer* pCont);
+ inline LwpObjectID& GetFirstPara();
+ inline LwpObjectID& GetLastPara();
+ XFContentContainer* GetXFContent();
+ void AddXFContent(XFContent* pContent);
+
+ bool GetDropcapFlag() const { return m_bDropcap; }
+ LwpPageLayout* GetCurrentLayout() { return m_pCurrentLayout; }
+ inline LwpMiddleLayout* GetTabLayout();//for register tab style
+ const OUString& GetSectionName() const { return m_CurrSectionName; }
+ LwpHyperlinkMgr* GetHyperlinkMgr() { return m_pHyperlinkMgr.get(); }
+
+ bool IsPMModified() const { return m_bPMModified; }
+ inline void SetPMModified(bool bPMModified);
+ inline void SetDropcapFlag(bool bFlag);
+ inline void SetTabLayout(LwpLayout* pLayout);
+ inline void SetSectionName(const OUString& StyleName);
+
+ void SetCurrentLayout(LwpPageLayout* pPageLayout);
+ LwpPageLayout* GetNextPageLayout();
+ bool IsNeedSection();
+ void SortPageLayout();
+
+ LwpPara* GetLastParaOfPreviousStory();
+
+ OUString GetContentText(bool bAllText = false);
+ inline void AddBullStyleName2List(const OUString& rStyleName, sal_uInt8 nPos);
+ bool IsBullStyleUsedBefore(const OUString& rStyleName, sal_uInt8 nPos);
+
+ OUString RegisterFirstFribStyle();
+};
+
+LwpObjectID& LwpStory::GetFirstPara()
+{
+ return m_ParaList.GetHead();
+}
+LwpObjectID& LwpStory::GetLastPara()
+{
+ return m_ParaList.GetTail();
+}
+LwpMiddleLayout* LwpStory::GetTabLayout()
+{
+ if(m_pTabLayout)
+ return m_pTabLayout;
+ return dynamic_cast<LwpMiddleLayout*>(GetLayout(nullptr).get());
+}
+void LwpStory::SetPMModified(bool bPMModified)
+{
+ m_bPMModified = bPMModified;
+}
+void LwpStory::SetDropcapFlag(bool bFlag)
+{
+ m_bDropcap = bFlag;
+}
+void LwpStory::SetTabLayout(LwpLayout* pLayout)
+{
+ m_pTabLayout = pLayout;
+}
+void LwpStory::SetSectionName(const OUString& StyleName)
+{
+ m_CurrSectionName = StyleName;
+}
+inline void LwpStory::AddBullStyleName2List(const OUString& rStyleName, sal_uInt8 nPos)
+{
+ m_vBulletStyleNameList.push_back(std::make_pair(rStyleName, nPos));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpstyledef.hxx b/lotuswordpro/source/filter/lwpstyledef.hxx
new file mode 100644
index 000000000..bbc042415
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpstyledef.hxx
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSTYLEDEF_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPSTYLEDEF_HXX
+
+#define INVALID_ATTR_ID 0
+#define EXTERNAL_ID 0x8000
+#define EXTERNAL_MASK 0x7FFF
+#define MAX_DESIGNERBORDERS 18
+
+#define BORDER_SOLID 1
+#define BORDER_SDASH 2
+#define BORDER_LDASH 3
+#define BORDER_WAVY 4
+#define BORDER_THKWAVY 5
+#define BORDER_LSDASH 6
+#define BORDER_LSSDASH 7
+#define BORDER_DOT 8
+#define BORDER_CIRCLE 9
+#define BORDER_DBLWAVY 10
+#define BORDER_DBLTHKWAVY 11
+#define BORDER_STAR 12
+#define BORDER_ROPE 13
+#define BORDER_DECO1 14
+#define BORDER_DECO2 15
+#define BORDER_RAIN 16
+#define BORDER_PIN 17
+#define BORDER_ROSE 18
+#define BORDER_SUNF 19
+#define BORDER_DECO3 20
+#define BORDER_WARNING 21
+// SPACE 22
+#define BORDER_GIRDER 23
+
+// User defined bitmap borders (200 - 400)
+
+// scalable lines
+#define BGRP_SOLID 20
+#define BGRP_DOUBLE_ONE 21
+#define BGRP_DOUBLE_TWO 22
+#define BGRP_121 23
+#define BGRP_31 24
+#define BGRP_13 25
+#define BGRP_WAVY 26
+#define BGRP_DBLWAVY 27
+#define BGRP_THICK_WAVY 28
+#define BGRP_THICK_DBLWAVY 29
+#define BGRP_SDASH 30
+#define BGRP_LDASH 31
+#define BGRP_LDASH_SDASH 32
+#define BGRP_LDASH_SDASH_SDASH 33
+#define BGRP_BUTTONUP 34
+#define BGRP_BUTTONDOWN 35
+#define BGRP_13SPACE 36
+#define BGRP_31SPACE 37
+#define BGRP_DIAGONAL 38
+#define BGRP_TARO 39
+#define BGRP_DOT 40
+#define BGRP_CIRCLE 41
+#define BGRP_STAR 42
+#define BGRP_ROPE 43
+#define BGRP_DECO1 44
+#define BGRP_DECO2 45
+#define BGRP_RAIN 46
+#define BGRP_PIN 47
+#define BGRP_ROSE 48
+#define BGRP_SUNF 49
+#define BGRP_DECO3 50
+#define BGRP_WARNING 51
+//SPACE 52
+#define BGRP_GIRDER 53
+
+#define UNIT_4_96 ((UNIT)196608L) //INCHES(4/96)
+#define UNIT_13_96 ((UNIT)638976L) //INCHES(13/96)
+#define UNIT_14_96 ((UNIT)688128L) //INCHES(14/96)
+#define UNIT_15_96 ((UNIT)737280L) //INCHES(15/96)
+#define UNIT_17_96 ((UNIT)835584L) //INCHES(17/96)
+#define UNIT_18_96 ((UNIT)884736L) //INCHES(18/96)
+#define UNIT_19_96 ((UNIT)933888L) //INCHES(19/96)
+#define UNIT_20_96 ((UNIT)983040L) //INCHES(20/96)
+#define UNIT_21_96 ((UNIT)1032192L) //INCHES(21/96)
+#define UNIT_22_96 ((UNIT)1081344L) //INCHES(22/96)
+#define UNIT_25_96 ((UNIT)1228800L) //INCHES(25/96)
+#define UNIT_28_96 ((UNIT)1376256L) //INCHES(28/96)
+#define UNIT_34_96 ((UNIT)1671108L) //INCHES(34/96)
+#define UNIT_42_96 ((UNIT)2064384L) //INCHES(42/96)
+#define UNIT_44_96 ((UNIT)2162688L) //INCHES(44/96)
+#define UNIT_48_96 ((UNIT)2359296L) //INCHES(48/96)
+#define UNIT_56_96 ((UNIT)2752512L) //INCHES(56/96)
+#define UNIT_64_96 ((UNIT)3145728L) //INCHES(64/96)
+
+#define ROPE_AMPLITUDE UNIT_18_96
+#define ROPE_PERIOD UNIT_20_96
+#define DECO1_AMPLITUDE UNIT_17_96
+#define DECO1_PERIOD UNIT_4_96
+#define DECO2_AMPLITUDE UNIT_18_96
+#define DECO2_PERIOD UNIT_64_96
+#define RAIN_AMPLITUDE UNIT_22_96
+#define RAIN_PERIOD UNIT_28_96
+#define PIN_AMPLITUDE UNIT_15_96
+#define PIN_PERIOD UNIT_4_96
+#define ROSE_AMPLITUDE UNIT_34_96
+#define ROSE_PERIOD UNIT_64_96
+#define SUNF_AMPLITUDE UNIT_25_96
+#define SUNF_PERIOD UNIT_48_96
+#define DECO3_AMPLITUDE UNIT_14_96
+#define DECO3_PERIOD UNIT_20_96
+
+#define ROPE_JOIN_W UNIT_18_96
+#define ROPE_JOIN_H UNIT_18_96
+#define DECO1_JOIN_W UNIT_56_96
+#define DECO1_JOIN_H UNIT_44_96
+#define DECO2_JOIN_W UNIT_64_96
+#define DECO2_JOIN_H UNIT_64_96
+#define RAIN_JOIN_W UNIT_48_96
+#define RAIN_JOIN_H UNIT_48_96
+#define PIN_JOIN_W UNIT_42_96
+#define PIN_JOIN_H UNIT_42_96
+#define ROSE_JOIN_W UNIT_48_96
+#define ROSE_JOIN_H UNIT_48_96
+#define SUNF_JOIN_W UNIT_48_96
+#define SUNF_JOIN_H UNIT_48_96
+#define DECO3_JOIN_W UNIT_56_96
+#define DECO3_JOIN_H UNIT_56_96
+
+// User defined bitmap border groups 200 - 400
+
+/* background patterns */
+#define BACK_TRANSPARENT 0
+#define BACK_FILL 1
+#define BACK_PATTERN 2
+#define BACK_10PCTDOTS 3
+#define BACK_30PCTDOTS 4
+#define BACK_50PCTDOTS 5
+#define BACK_75PCTDOTS 6
+#define BACK_90PCTDOTS 7
+#define BACK_90PCTINVDOTS 8
+#define BACK_75PCTINVDOTS 9
+#define BACK_50PCTINVDOTS 10
+#define BACK_30PCTINVDOTS 11
+#define BACK_10PCTINVDOTS 12
+#define BACK_MARBLES 13
+#define BACK_STARRYNIGHT 14
+#define BACK_DIAGTHICK 15
+#define BACK_DIAGTHIN 16
+#define BACK_DIAGDOUBLE 17
+#define BACK_DIAGDOUBLENARROW 18
+#define BACK_DIAGTRIPLE 19
+#define BACK_DIAGSINGLEWIDE 20
+#define BACK_DIAGTHICKINV 21
+#define BACK_DIAGTHININV 22
+#define BACK_DIAGDOUBLEINV 23
+#define BACK_DIAGDOUBLENARROWINV 24
+#define BACK_DIAGTRIPLEINV 25
+#define BACK_DIAGSINGLEWIDEINV 26
+#define BACK_CHAINLINKSMALLINV 27
+#define BACK_CHAINLINKSMALL 28
+#define BACK_CHAINLINKMEDIUM 29
+#define BACK_CHAINLINKLARGE 30
+#define BACK_HORZSTRIPE1 31
+#define BACK_HORZSTRIPE2 32
+#define BACK_HORZSTRIPE3 33
+#define BACK_HORZSTRIPE4 34
+#define BACK_VERTSTRIPE1 35
+#define BACK_VERTSTRIPE2 36
+#define BACK_VERTSTRIPE3 37
+#define BACK_VERTSTRIPE4 38
+#define BACK_GRIDSMALL 39
+#define BACK_GRIDMEDIUM 40
+#define BACK_GRIDLARGE 41
+#define BACK_BOXDOT 42
+#define BACK_GOLFGREEN 43
+#define BACK_DITZ 44
+#define BACK_HORZWEAVE 45
+#define BACK_APPLEPIE 46
+#define BACK_BRICK 47
+#define BACK_DIAGBRICK 48
+#define BACK_CHECKER1 49
+#define BACK_CHECKER2 50
+#define BACK_CHECKER3 51
+#define BACK_CHECKER4 52
+#define BACK_CHECKER5 53
+#define BACK_SNOWFLAKE 54
+#define BACK_MARGARITA 55
+#define BACK_SIDEHARP 56
+#define BACK_SCALES 57
+#define BACK_TAYLOR 58
+#define BACK_BUBBLES 59
+#define BACK_ARGYLE 60
+#define BACK_INDIAN1 61
+#define BACK_INDIAN3 62
+#define BACK_PEACHPIE 63
+#define BACK_GRADIENT1 64
+#define BACK_GRADIENT2 65
+#define BACK_GRADIENT3 66
+#define BACK_GRADIENT4 67
+#define BACK_GRADIENT5 68
+#define BACK_GRADIENT6 69
+#define BACK_GRADIENT7 70
+#define BACK_GRADIENT8 71
+
+#endif //STYLEDEF_H_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpsvstream.cxx b/lotuswordpro/source/filter/lwpsvstream.cxx
new file mode 100644
index 000000000..4ab5c03c4
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpsvstream.cxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <lwpsvstream.hxx>
+#include <tools/stream.hxx>
+
+const sal_uInt32 LwpSvStream::LWP_STREAM_BASE = 0x0010;
+
+LwpSvStream::LwpSvStream(SvStream* pStream, LwpSvStream * pCompressed)
+ : m_pStream(pStream), m_pCompressedStream(pCompressed)
+{
+}
+
+/**
+ * @descr read nBytesToRead bytes to buf
+*/
+size_t LwpSvStream::Read(void* buf, size_t nBytesToRead)
+{
+ return m_pStream->ReadBytes(buf, nBytesToRead);
+}
+
+LwpSvStream& LwpSvStream::ReadUInt8( sal_uInt8& rUInt8 )
+{
+ m_pStream->ReadUChar( rUInt8 );
+ return *this;
+}
+
+LwpSvStream& LwpSvStream::ReadUInt16( sal_uInt16& rUInt16 )
+{
+ m_pStream->ReadUInt16( rUInt16 );
+ return *this;
+}
+
+LwpSvStream& LwpSvStream::ReadUInt32( sal_uInt32& rUInt32 )
+{
+ m_pStream->ReadUInt32( rUInt32 );
+ return *this;
+}
+
+/**
+ * @descr SeekRel in stream
+*/
+void LwpSvStream::SeekRel(sal_Int64 pos)
+{
+ m_pStream->SeekRel(pos);
+}
+/**
+ * @descr Get the current position in stream
+*/
+sal_Int64 LwpSvStream::Tell()
+{
+ return m_pStream->Tell();
+}
+/**
+ * @descr Seek to pos
+*/
+sal_Int64 LwpSvStream::Seek(sal_Int64 pos)
+{
+ return m_pStream->Seek(pos);
+}
+
+bool LwpSvStream::CheckSeek(sal_Int64 pos)
+{
+ return checkSeek(*m_pStream, pos);
+}
+/**
+ * @descr Return the stream data length
+*/
+//sal_Int64 LwpSvStream::GetLength()
+//{
+// return m_pStream->get
+//}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptable.cxx b/lotuswordpro/source/filter/lwptable.cxx
new file mode 100644
index 000000000..143b99ca5
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptable.cxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table object
+ */
+
+#include <sal/config.h>
+
+#include <algorithm>
+
+#include <lwpfilehdr.hxx>
+ #include "lwptable.hxx"
+
+ LwpSuperTable::LwpSuperTable(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpContent(objHdr, pStrm)
+{}
+
+LwpSuperTable::~LwpSuperTable()
+{}
+
+void LwpSuperTable::Read()
+{
+ LwpContent::Read();
+ m_pObjStrm->SkipExtra();
+
+}
+
+void LwpSuperTable::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+void LwpSuperTable::XFConvert(XFContentContainer* /*pCont*/)
+{
+}
+
+/*****************************************************************************/
+ LwpTable::LwpTable(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpContent(objHdr, pStrm)
+ , m_nRow(0)
+ , m_nColumn(0)
+ , m_nHeight(0)
+ , m_nWidth(0)
+ , m_nDefaultAutoGrowRowHeight(0)
+ , m_nAttributes(0)
+{}
+
+LwpTable::~LwpTable()
+{}
+
+void LwpTable::Read()
+{
+ LwpContent::Read();
+ //m_RowCache.Read(m_pObjStrm);
+ //m_ColumnCache.Read(m_pObjStrm);
+
+ //m_CPNotifyList.Read(m_pObjStrm);
+ //m_CPTempVersionedNotifyList.Read(m_pObjStrm);
+
+ m_nRow = m_pObjStrm->QuickReaduInt16();
+ m_nColumn = m_pObjStrm->QuickReaduInt16();
+
+ m_nHeight = m_pObjStrm->QuickReadInt32();
+ m_nWidth = m_pObjStrm->QuickReadInt32();
+
+ m_nDefaultAutoGrowRowHeight = m_pObjStrm->QuickReadInt32();
+
+ m_nAttributes = m_pObjStrm->QuickReaduInt16();
+
+ m_Layout.ReadIndexed(m_pObjStrm.get());
+
+ m_DefaultCellStyle.ReadIndexed(m_pObjStrm.get());
+ if (LwpFileHeader::m_nFileRevision >= 0x0007)
+ m_CPNotifyList.Read(m_pObjStrm.get());
+
+ m_pObjStrm->SkipExtra();
+}
+
+bool LwpTable::IsNumberDown() const
+{
+ return (m_nAttributes & NUMBER_DOWN) != 0;
+}
+
+void LwpTable::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+ LwpSuperTableLayout* LwpTable::GetSuperTableLayout()
+{
+ LwpTableLayout* pLayout = dynamic_cast<LwpTableLayout*>(m_Layout.obj().get());
+ if(pLayout)
+ return dynamic_cast<LwpSuperTableLayout*>(pLayout->GetParent().obj().get());
+
+ return nullptr;
+}
+
+ /*****************************************************************************/
+ LwpTableHeading::LwpTableHeading(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
+{}
+
+LwpTableHeading::~LwpTableHeading()
+{}
+
+void LwpTableHeading::Read()
+{
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpTableHeading::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+ /*****************************************************************************/
+LwpParallelColumns::LwpParallelColumns(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
+{
+}
+
+LwpParallelColumns::~LwpParallelColumns()
+{
+}
+
+void LwpParallelColumns::Read()
+{
+ LwpTable::Read();
+ cDefaultLeftColumnStyle.ReadIndexed(m_pObjStrm.get());
+ cDefaultRightColumnStyle.ReadIndexed(m_pObjStrm.get());
+
+ m_pObjStrm->SkipExtra();
+}
+ /*****************************************************************************/
+LwpGlossary::LwpGlossary(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpParallelColumns(objHdr, pStrm)
+{
+}
+
+LwpGlossary::~LwpGlossary()
+{
+}
+sal_uInt16 LwpGlossary::GetNumIndexRows() const
+{
+ if (GetRow() > 0 && GetRow() <= MAX_NUM_ROWS)
+ return GetRow() - 1; // Minus one row for repeated heading.
+ return 0;
+}
+
+void LwpGlossary::Read()
+{
+ LwpParallelColumns::Read();
+
+ sal_uInt16 FiledEntries = m_pObjStrm->QuickReaduInt16();
+ sal_uInt16 NumIndexRows = GetNumIndexRows();
+
+ if (FiledEntries < NumIndexRows)
+ {
+ /* We'll have to do sequential (slow) searches. */
+ m_pObjStrm->SeekRel( FiledEntries * sizeof(sal_uInt16));
+ }
+ else
+ {
+ if (NumIndexRows)
+ {
+ sal_uInt16 EntriesRead = std::min(FiledEntries, NumIndexRows);
+
+ for (sal_uInt16 EntryCount = 1; EntryCount <= EntriesRead; EntryCount++)
+ m_pObjStrm->QuickReaduInt16();
+
+ if (FiledEntries > EntriesRead)
+ m_pObjStrm->SeekRel((FiledEntries - EntriesRead)* sizeof(sal_uInt16));
+ }
+ else
+ m_pObjStrm->SeekRel(FiledEntries * sizeof(sal_uInt16));
+ }
+
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptable.hxx b/lotuswordpro/source/filter/lwptable.hxx
new file mode 100644
index 000000000..b55d7a4b4
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptable.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table object
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLE_HXX
+
+#include <lwpobjhdr.hxx>
+#include <lwpobjid.hxx>
+#include "lwppara.hxx"
+#include <lwptools.hxx>
+#include "lwptablelayout.hxx"
+
+class LwpTableLayout;
+/**
+ * @brief
+ * VO_SUPERTABLE object
+ */
+class LwpSuperTable: public LwpContent
+{
+public:
+ LwpSuperTable(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpSuperTable() override;
+
+ virtual void Parse(IXFStream* pOutputStream) override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+protected:
+ void Read() override;
+};
+/**
+ * @brief
+ * for VO_TABLE object reading
+ */
+class LwpForkedNotifyList final
+{
+public:
+ LwpForkedNotifyList(){}
+ void Read(LwpObjectStream* pObjStrm)
+ {
+ m_PersistentList.Read(pObjStrm);
+ };
+
+private:
+ LwpNotifyListPersistent m_PersistentList;
+};
+/**
+ * @brief
+ * VO_TABLE object
+ */
+class LwpTable: public LwpContent
+{
+public:
+ LwpTable(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpTable() override;
+
+ virtual void Parse(IXFStream* pOutputStream) override;
+ double GetWidth() {return LwpTools::ConvertFromUnitsToMetric(m_nWidth);}
+ double GetHeight() {return LwpTools::ConvertFromUnitsToMetric(m_nHeight);}
+ LwpObjectID& GetDefaultCellStyle() {return m_DefaultCellStyle;}
+ sal_uInt16 GetRow() const {return m_nRow;}
+ sal_uInt16 GetColumn() const {return m_nColumn;}
+ rtl::Reference<LwpTableLayout> GetTableLayout()
+ {
+ return rtl::Reference<LwpTableLayout>(dynamic_cast<LwpTableLayout*>(GetLayout(nullptr).get()));
+ }
+ bool IsNumberDown() const;
+ virtual bool IsTable() override { return true;}
+ LwpSuperTableLayout* GetSuperTableLayout();
+protected:
+ LwpForkedNotifyList m_CPNotifyList;
+
+ sal_uInt16 m_nRow, m_nColumn;
+ sal_Int32 m_nHeight;
+ sal_Int32 m_nWidth;
+ sal_Int32 m_nDefaultAutoGrowRowHeight;
+ sal_uInt16 m_nAttributes;
+ enum lTableAttributes
+ {
+ NUMBER_DOWN = 0x01,
+ SIZING_VIA_MOUSE_ENABLED = 0x02,
+ NUMBER_RESET = 0x04
+ };
+
+ LwpObjectID m_Layout;
+ LwpObjectID m_DefaultCellStyle; // gCVirtualLayout
+ void Read() override;
+};
+
+/**
+ * @brief
+ * VO_TABLEHEADING object
+ */
+class LwpTableHeading : public LwpTable
+{
+public:
+ LwpTableHeading(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpTableHeading() override;
+
+ virtual void Parse(IXFStream* pOutputStream) override;
+protected:
+ void Read() override;
+
+};
+class LwpParallelColumns : public LwpTable
+{
+public:
+ LwpParallelColumns(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpParallelColumns() override;
+protected:
+ void Read() override;
+private:
+ LwpObjectID cDefaultLeftColumnStyle;
+ LwpObjectID cDefaultRightColumnStyle;
+};
+
+#define MAX_NUM_ROWS 8192
+#define MAX_NUM_COLS 255
+
+class LwpGlossary final : public LwpParallelColumns
+{
+public:
+ LwpGlossary(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpGlossary() override;
+private:
+ void Read() override;
+ sal_uInt16 GetNumIndexRows() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
new file mode 100644
index 000000000..00da4c254
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -0,0 +1,1577 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table layouts
+ */
+
+#include <lwpglobalmgr.hxx>
+#include "lwptablelayout.hxx"
+#include <lwpfoundry.hxx>
+#include <lwpobjfactory.hxx>
+#include "lwpholder.hxx"
+#include "lwptable.hxx"
+#include "lwptblcell.hxx"
+#include "lwpnumericfmt.hxx"
+#include "lwpdlvlist.hxx"
+#include "lwppara.hxx"
+#include "lwprowlayout.hxx"
+#include <lwpfilehdr.hxx>
+
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xftablestyle.hxx>
+#include <xfilter/xfrow.hxx>
+#include <xfilter/xfrowstyle.hxx>
+#include <xfilter/xfcell.hxx>
+#include <xfilter/xfcellstyle.hxx>
+#include <xfilter/xfcolstyle.hxx>
+#include <xfilter/xfframestyle.hxx>
+#include <xfilter/xfframe.hxx>
+#include <xfilter/xffloatframe.hxx>
+#include "lwpframelayout.hxx"
+#include <xfilter/xfparastyle.hxx>
+#include <o3tl/sorted_vector.hxx>
+#include <sal/log.hxx>
+
+#include <algorithm>
+#include <memory>
+
+LwpSuperTableLayout::LwpSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpPlacableLayout(objHdr, pStrm)
+{
+ m_pFrame.reset(new LwpFrame(this) );
+}
+
+LwpSuperTableLayout::~LwpSuperTableLayout()
+{
+}
+/**
+ * @short Read super table layout record
+ */
+void LwpSuperTableLayout::Read()
+{
+ LwpPlacableLayout::Read();
+ m_pObjStrm->SkipExtra();
+
+}
+/**
+ * @short Get child table layout
+ * @return pointer to table layout
+ */
+LwpTableLayout* LwpSuperTableLayout::GetTableLayout()
+{
+ LwpObjectID *pID = &GetChildTail();
+
+ while(pID && !pID->IsNull())
+ {
+ LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pID->obj().get());
+ if (!pLayout)
+ {
+ break;
+ }
+ if (pLayout->GetLayoutType() == LWP_TABLE_LAYOUT)
+ {
+ return dynamic_cast<LwpTableLayout *>(pLayout);
+ }
+ pID = &pLayout->GetPrevious();
+ }
+
+ return nullptr;
+}
+/**
+ * @short Get effective heading table layout, the one just before table layout is the only one which is effective
+ * @return LwpTableHeadingLayout* - pointer to table heading layout
+ */
+LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout()
+{
+ LwpObjectID *pID = &GetChildTail();
+
+ while(pID && !pID->IsNull())
+ {
+ LwpLayout * pLayout = dynamic_cast<LwpLayout *>(pID->obj().get());
+ if (!pLayout)
+ {
+ break;
+ }
+
+ if (pLayout->GetLayoutType() == LWP_TABLE_HEADING_LAYOUT)
+ {
+ return dynamic_cast<LwpTableHeadingLayout *>(pLayout);
+ }
+ pID = &pLayout->GetPrevious();
+ }
+
+ return nullptr;
+}
+/**
+ * @short Register super table layout style
+ */
+void LwpSuperTableLayout::RegisterNewStyle()
+{
+ // if this layout is style of real table entry
+ LwpTableLayout* pTableLayout = GetTableLayout();
+ if (pTableLayout != nullptr)
+ {
+ pTableLayout->SetFoundry(m_pFoundry);
+ pTableLayout->RegisterStyle();
+ }
+}
+/**
+ * @short Judge whether table size is according to content, borrowed from Word Pro code
+ * @param
+ * @return sal_Bool
+ */
+bool LwpSuperTableLayout::IsSizeRightToContent()
+{
+ /* Only "with paragraph above" tables can size right to content. */
+ if (GetRelativeType() == LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE)
+ return LwpPlacableLayout::IsSizeRightToContent();
+
+ return false;
+}
+/**
+ * @short Judge whether table is justifiable, borrowed from Word Pro code
+ * @param
+ * @return sal_Bool
+ */
+bool LwpSuperTableLayout::IsJustifiable()
+{
+ return (GetRelativeType() != LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE || IsSizeRightToContent());
+}
+/**
+ * @short Get width of frame outside table
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return double - table width
+ */
+double LwpSuperTableLayout::GetWidth()
+{
+ double dWidth = GetTableWidth();
+ double dLeft = GetMarginsValue(MARGIN_LEFT);
+ double dRight = GetMarginsValue(MARGIN_RIGHT);
+
+ return (dWidth + dLeft + dRight);
+}
+/**
+ * @short Get width of table
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return double - table width
+ */
+double LwpSuperTableLayout::GetTableWidth()
+{
+ sal_Int32 nWidth = 0;
+ if(!IsJustifiable() || ((nWidth = LwpMiddleLayout::GetMinimumWidth()) <= 0))
+ {
+ LwpTableLayout* pTableLayout = GetTableLayout();
+ if(!pTableLayout)
+ {
+ SAL_WARN("lwp", "missing table layout, early return");
+ return 0;
+ }
+ LwpTable *pTable = pTableLayout->GetTable();
+ if(!pTable)
+ {
+ SAL_WARN("lwp", "missing table, early return");
+ return 0;
+ }
+ double dDefaultWidth = pTable->GetWidth();
+ sal_uInt16 nCol = pTable->GetColumn();
+
+ double dWidth = 0;
+
+ for(sal_uInt16 i =0; i< nCol; i++)
+ {
+ LwpObjectID *pColumnID = &pTableLayout->GetColumnLayoutHead();
+ LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
+ double dColumnWidth = dDefaultWidth;
+ o3tl::sorted_vector<LwpColumnLayout*> aSeen;
+ while (pColumnLayout)
+ {
+ aSeen.insert(pColumnLayout);
+ if(pColumnLayout->GetColumnID() == i)
+ {
+ dColumnWidth = pColumnLayout->GetWidth();
+ break;
+ }
+ pColumnID = &pColumnLayout->GetNext();
+ pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
+ if (aSeen.find(pColumnLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ dWidth += dColumnWidth;
+ }
+
+ return dWidth;
+ }
+
+ double dLeft = GetMarginsValue(MARGIN_LEFT);
+ double dRight = GetMarginsValue(MARGIN_RIGHT);
+ return LwpTools::ConvertFromUnitsToMetric(nWidth)-dLeft-dRight;
+
+}
+/**
+ * @short Apply shadow to table
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return
+ */
+void LwpSuperTableLayout::ApplyShadow(XFTableStyle *pTableStyle)
+{
+ // use shadow property of supertable
+ std::unique_ptr<XFShadow> pXFShadow(GetXFShadow());
+ if(pXFShadow)
+ {
+ pTableStyle->SetShadow(pXFShadow->GetPosition(), pXFShadow->GetOffset(), pXFShadow->GetColor());
+ }
+}
+/**
+ * @short Apply pattern fill to table style
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return
+ */
+void LwpSuperTableLayout::ApplyPatternFill(XFTableStyle* pTableStyle)
+{
+ std::unique_ptr<XFBGImage> xXFBGImage(GetFillPattern());
+ if (xXFBGImage)
+ {
+ pTableStyle->SetBackImage(xXFBGImage);
+ }
+}
+
+/**
+ * @short Apply background to table style
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return
+ */
+void LwpSuperTableLayout::ApplyBackGround(XFTableStyle* pTableStyle)
+{
+ if (IsPatternFill())
+ {
+ ApplyPatternFill(pTableStyle);
+ }
+ else
+ {
+ ApplyBackColor(pTableStyle);
+ }
+}
+/**
+ * @short Apply back color to table
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return
+ */
+void LwpSuperTableLayout::ApplyBackColor(XFTableStyle *pTableStyle)
+{
+ LwpColor* pColor = GetBackColor();
+ if(pColor && pColor->IsValidColor())
+ {
+ XFColor aColor(pColor->To24Color());
+ pTableStyle->SetBackColor(aColor);
+ }
+}
+/**
+ * @short Apply watermark to table
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return
+ */
+void LwpSuperTableLayout::ApplyWatermark(XFTableStyle *pTableStyle)
+{
+ std::unique_ptr<XFBGImage> xBGImage(GetXFBGImage());
+ if (xBGImage)
+ {
+ pTableStyle->SetBackImage(xBGImage);
+ }
+}
+/**
+ * @short Apply alignment to table
+ * @param pTableStyle - pointer of XFTableStyle
+ * @return
+ */
+void LwpSuperTableLayout::ApplyAlignment(XFTableStyle * pTableStyle)
+{
+ LwpPoint aPoint;
+ if (LwpLayoutGeometry* pGeometry = GetGeometry())
+ aPoint = pGeometry->GetOrigin();
+ double dXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
+
+ // add left padding to alignment distance
+ double dLeft = GetMarginsValue(MARGIN_LEFT);
+
+ pTableStyle->SetAlign(enumXFAlignStart, dXOffset+ dLeft);
+}
+/**
+ * @short Add table to container
+ * @param pCont - pointer of container
+ * @return pCont
+ */
+void LwpSuperTableLayout::XFConvert(XFContentContainer* pCont)
+{
+ if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == GetRelativeType()
+ && (!GetContainerLayout().is() || !GetContainerLayout()->IsCell()) )
+ {
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (pTableLayout)
+ {
+ pTableLayout->XFConvert(pCont);
+ }
+ }
+ else if(IsRelativeAnchored())
+ {
+ //anchor to paragraph except "with paragraph above"
+ XFConvertFrame(pCont);
+ }
+ else if(m_pFrame)
+ {
+ //anchor to page, frame, cell
+ m_pFrame->XFConvert(pCont);
+ }
+}
+/**
+ * @short convert frame which anchor to page
+ * @param
+ * @return
+ */
+void LwpSuperTableLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart, sal_Int32 nEnd, bool bAll)
+{
+ if(!m_pFrame)
+ return;
+
+ rtl::Reference<XFFrame> xXFFrame;
+ if(nEnd < nStart)
+ {
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
+
+ m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart));
+ //parse table, and add table to frame
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (pTableLayout)
+ {
+ pTableLayout->XFConvert(xXFFrame.get());
+ }
+ //add frame to the container
+ pCont->Add(xXFFrame.get());
+
+}
+/**
+ * @short register frame style
+ * @param
+ * @return
+ */
+void LwpSuperTableLayout::RegisterFrameStyle()
+{
+ std::unique_ptr<XFFrameStyle> xFrameStyle(new XFFrameStyle);
+ m_pFrame->RegisterStyle(xFrameStyle);
+}
+
+LwpTableLayout::LwpTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpLayout(objHdr, pStrm)
+ , m_nRows(0)
+ , m_nCols(0)
+ , m_pDefaultCellLayout(nullptr)
+ , m_bConverted(false)
+{
+}
+
+/**
+ * @short Get neighbour cell by specifying ROW+COL
+ * @param nRow
+ * @param nCol
+ * @return LwpCellLayout *
+ */
+LwpCellLayout * LwpTableLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol)
+{
+ if (nRow >= m_nRows || nCol >= m_nCols)
+ return nullptr;
+
+ return m_WordProCellsMap[static_cast<size_t>(nRow)*m_nCols + nCol];
+}
+
+/**
+ * @short traverse all table cells
+ * @param
+ * @param
+ * @param
+ */
+void LwpTableLayout::TraverseTable()
+{
+ sal_uInt32 nCount = m_nRows*m_nCols;
+
+ // new cell map nRow*nCOl and initialize
+ m_WordProCellsMap.insert(m_WordProCellsMap.end(), nCount, m_pDefaultCellLayout);
+
+ // set value
+ LwpObjectID* pRowID = &GetChildHead();
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ o3tl::sorted_vector<LwpRowLayout*> aSeen;
+ while (pRowLayout)
+ {
+ aSeen.insert(pRowLayout);
+
+ pRowLayout->SetRowMap();
+
+ // for 's analysis job
+ m_RowsMap[pRowLayout->GetRowID()] = pRowLayout;
+ pRowLayout->CollectMergeInfo();
+ // end for 's analysis
+
+ pRowID = &pRowLayout->GetNext();
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ if (aSeen.find(pRowLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+}
+
+/**
+ * @short search the cell map
+ * @param nRow - row id (0 based)
+ * @param nRow - row id (0 based)
+ * @return LwpObjectID * - pointer to cell story object ID
+ */
+LwpObjectID * LwpTableLayout::SearchCellStoryMap(sal_uInt16 nRow, sal_uInt16 nCol)
+{
+ if (nRow >= m_nRows || nCol >= m_nCols )
+ {
+ return nullptr;
+ }
+
+ LwpCellLayout * pCell = GetCellByRowCol(nRow, nCol);
+ if (pCell)
+ {
+ // maybe connected cell layout
+ // maybe default cell layout
+ if (nRow != pCell->GetRowID() || nCol != pCell->GetColID())
+ {
+ return nullptr;
+ }
+ return &pCell->GetContent();
+ }
+
+ return nullptr;
+}
+
+/**
+ * @short Get parent super table layout of table layout
+ * @return LwpSuperTableLayout * - pointer of parent super table layout
+ */
+LwpSuperTableLayout * LwpTableLayout::GetSuperTableLayout()
+{
+ return dynamic_cast<LwpSuperTableLayout *>(GetParent().obj().get());
+}
+/**
+ * @short Get table pointer
+ * @return LwpTable * - content table pointer
+ */
+LwpTable * LwpTableLayout::GetTable()
+{
+ LwpTable *pTable = dynamic_cast<LwpTable *>(m_Content.obj().get());
+ return pTable;
+}
+/**
+ * @short Get column style name by column ID
+ * @param sal_uInt16 -- col id(0 based)
+ * @return OUString - name of column style
+ */
+OUString LwpTableLayout::GetColumnWidth(sal_uInt16 nCol)
+{
+ if (nCol >= m_nCols)
+ {
+ assert(false);
+ return m_DefaultColumnStyleName;
+ }
+
+ LwpColumnLayout * pCol = m_aColumns[nCol];
+ if (pCol)
+ {
+ return pCol->GetStyleName();
+ }
+
+ return m_DefaultColumnStyleName;
+}
+/**
+ * @short analyze all columns to get whole table width and width of all columns
+ * @short and register all column styles
+ * @param none
+ */
+void LwpTableLayout::RegisterColumns()
+{
+ LwpTable* pTable = GetTable();
+ if (!pTable)
+ throw std::range_error("corrupt LwpTableLayout");
+
+ LwpSuperTableLayout* pSuper = GetSuperTableLayout();
+ if (!pSuper)
+ throw std::range_error("corrupt LwpTableLayout");
+
+ sal_uInt16 nCols = m_nCols;
+
+ m_aColumns.resize(nCols);
+ std::unique_ptr<bool[]> pWidthCalculated( new bool[nCols] );
+ for(sal_uInt16 i=0;i<nCols; i++)
+ {
+ pWidthCalculated[i] = false;
+ m_aColumns[i] = nullptr;
+ }
+
+ double dDefaultColumn = pTable->GetWidth();
+ sal_uInt16 nJustifiableColumn = nCols;
+
+ double dTableWidth = pSuper->GetTableWidth();
+
+ // Get total width of justifiable columns
+ // NOTICE: all default columns are regarded as justifiable columns
+ LwpObjectID* pColumnID = &GetColumnLayoutHead();
+ LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
+ o3tl::sorted_vector<LwpColumnLayout*> aSeen;
+ while (pColumnLayout)
+ {
+ aSeen.insert(pColumnLayout);
+
+ auto nColId = pColumnLayout->GetColumnID();
+ if (nColId >= nCols)
+ {
+ throw std::range_error("corrupt LwpTableLayout");
+ }
+ m_aColumns[nColId] = pColumnLayout;
+ if (!pColumnLayout->IsJustifiable())
+ {
+ pWidthCalculated[nColId] = true;
+ dTableWidth -= pColumnLayout->GetWidth();
+ nJustifiableColumn --;
+ }
+
+ pColumnID = &pColumnLayout->GetNext();
+ pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
+
+ if (aSeen.find(pColumnLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+
+ // if all columns are not justifiable, the rightmost column will be changed to justifiable
+ if (nJustifiableColumn == 0 && nCols != 0)
+ {
+ nJustifiableColumn ++;
+ if (m_aColumns[nCols - 1])
+ {
+ pWidthCalculated[nCols-1] = false;
+ dTableWidth += m_aColumns[nCols-1]->GetWidth();
+ }
+ else
+ {
+ // this can't happen
+ dTableWidth = dDefaultColumn;
+ assert(false);
+ }
+ }
+
+ // justifiable columns will share the remain width averagely
+ dDefaultColumn = nJustifiableColumn ? dTableWidth/nJustifiableColumn : 0;
+
+ // register default column style
+ std::unique_ptr<XFColStyle> xColStyle(new XFColStyle);
+ xColStyle->SetWidth(static_cast<float>(dDefaultColumn));
+
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_DefaultColumnStyleName = pXFStyleManager->AddStyle(std::move(xColStyle)).m_pStyle->GetStyleName();
+
+ // register existed column style
+ sal_uInt16 i=0;
+ for( i=0;i<nCols; i++)
+ {
+ if (m_aColumns[i])
+ {
+ m_aColumns[i]->SetFoundry(m_pFoundry);
+ if(!pWidthCalculated[i])
+ {
+ // justifiable ----register style with calculated value
+ m_aColumns[i]->SetStyleName(m_DefaultColumnStyleName);
+ }
+ else
+ {
+ // not justifiable ---- register style with original value
+ m_aColumns[i]->RegisterStyle(m_aColumns[i]->GetWidth());
+ }
+ }
+ }
+}
+/**
+ * @short register all row styles
+ * @param none
+ */
+void LwpTableLayout::RegisterRows()
+{
+ LwpTable * pTable = GetTable();
+ if (pTable == nullptr)
+ {
+ assert(false);
+ return;
+ }
+
+ // register default row style
+ std::unique_ptr<XFRowStyle> xRowStyle(new XFRowStyle);
+ if (m_nDirection & 0x0030)
+ {
+ xRowStyle->SetMinRowHeight(static_cast<float>(pTable->GetHeight()));
+ }
+ else
+ {
+ xRowStyle->SetRowHeight(static_cast<float>(pTable->GetHeight()));
+ }
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_DefaultRowStyleName = pXFStyleManager->AddStyle(std::move(xRowStyle)).m_pStyle->GetStyleName();
+
+ // register style of rows
+ LwpObjectID * pRowID = &GetChildHead();
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ while (pRowLayout)
+ {
+ pRowLayout->SetFoundry(m_pFoundry);
+ pRowLayout->RegisterStyle();
+
+ pRowID = &pRowLayout->GetNext();
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ }
+}
+/**
+ * @short register table style, if needed, including frame style
+ * @param none
+ */
+void LwpTableLayout::RegisterStyle()
+{
+ // get super table layout
+ LwpSuperTableLayout * pSuper = GetSuperTableLayout();
+ if (!pSuper)
+ return;
+
+ // get table
+ LwpTable * pTable = GetTable();
+ if (pTable == nullptr)
+ {
+ SAL_WARN("lwp", "missing table, early return");
+ return;
+ }
+
+ // get row/column number of this table
+ m_nRows = pTable->GetRow();
+ m_nCols = pTable->GetColumn();
+ //http://www.danielsays.com/ss-gallery-win1x2x3x-lotus-word-pro-96.html
+ //tables with up to 255 rows and 8192 columns
+ //the row limit tallies with the casting of m_nCols to an unsigned char
+ //elsewhere
+ if (m_nRows > MAX_NUM_ROWS)
+ throw std::runtime_error("max legal row exceeded");
+ if (m_nCols > MAX_NUM_COLS)
+ throw std::runtime_error("max legal column exceeded");
+
+ // get default cell layout of current table
+ LwpObjectID& rID= pTable->GetDefaultCellStyle();
+ m_pDefaultCellLayout = dynamic_cast<LwpCellLayout *>(rID.obj().get());
+
+ // register columns styles
+ RegisterColumns();
+
+ // register style of whole table
+ std::unique_ptr<XFTableStyle> xTableStyle(new XFTableStyle);
+
+ sal_uInt8 nType = pSuper->GetRelativeType();
+ // If the table is not "with paragraph above" placement, create an frame style
+ // by supertable layout
+ if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
+ && (!pSuper->GetContainerLayout().is() || !pSuper->GetContainerLayout()->IsCell()) )
+ {
+ //with para above
+ pSuper->ApplyBackGround(xTableStyle.get());
+ pSuper->ApplyWatermark(xTableStyle.get());
+ pSuper->ApplyShadow(xTableStyle.get());
+ pSuper->ApplyAlignment(xTableStyle.get());
+ xTableStyle->SetWidth(pSuper->GetTableWidth());
+ }
+ else
+ {
+ pSuper->RegisterFrameStyle();
+ xTableStyle->SetAlign(enumXFAlignCenter);
+ xTableStyle->SetWidth(pSuper->GetTableWidth());
+ }
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xTableStyle)).m_pStyle->GetStyleName();
+
+ //convert to OO table now and register row style traverse
+ TraverseTable();
+
+ SplitConflictCells();
+
+ // Register rows layouts, it must be after SplitConflictCells
+ RegisterRows();
+
+ // Parse table
+ ParseTable();
+
+ // the old code doesn't check if the LwpFoundry pointer is NULL,
+ // so the NULL pointer cause sodc freeze. Add code to check the pointer.
+ if (GetFoundry())
+ PutCellVals(GetFoundry(), pTable->GetObjectID());
+}
+/**
+ * @short read table layout
+ * @param none
+ */
+void LwpTableLayout::ParseTable()
+{
+ // get super table layout
+ LwpSuperTableLayout* pSuper = GetSuperTableLayout();
+ if (!pSuper)
+ {
+ throw std::runtime_error("missing super table");
+ }
+
+ if (m_pXFTable)
+ {
+ throw std::runtime_error("this table is already parsed");
+ }
+
+ // set name of object
+ m_pXFTable.set(new XFTable);
+
+ m_pXFTable->SetTableName(pSuper->GetName().str());
+ // set table style
+ m_pXFTable->SetStyleName(m_StyleName);
+
+ sal_uInt16 nRow = m_nRows;
+ sal_uInt8 nCol = static_cast<sal_uInt8>(m_nCols);
+
+ //process header rows
+ LwpTableHeadingLayout* pTableHeading;
+ pTableHeading = pSuper->GetTableHeadingLayout();
+ sal_uInt16 nStartHeadRow;
+ sal_uInt16 nEndHeadRow;
+ sal_uInt16 nContentRow;
+ if (pTableHeading)
+ {
+ pTableHeading->GetStartEndRow(nStartHeadRow,nEndHeadRow);
+ if (nStartHeadRow != 0)
+ ConvertTable(m_pXFTable,0,nRow,0,nCol);
+ else
+ {
+ nContentRow = ConvertHeadingRow(m_pXFTable,nStartHeadRow,nEndHeadRow+1);
+ ConvertTable(m_pXFTable,nContentRow,nRow,0,nCol);
+ }
+ }
+ else
+ ConvertTable(m_pXFTable,0,nRow,0,nCol);
+}
+
+/**
+ * @short read table layout
+ * @param none
+ */
+void LwpTableLayout::Read()
+{
+ LwpLayout::Read();
+
+ // before layout hierarchy rework!
+ if(LwpFileHeader::m_nFileRevision < 0x000b)
+ {
+ assert(false);
+ }
+ m_ColumnLayout.ReadIndexed(m_pObjStrm.get());
+
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+ * @short Convert table
+ * @param
+ * @return pCont - container which will contain table
+ */
+void LwpTableLayout::XFConvert(XFContentContainer* pCont)
+{
+ if (!m_pXFTable)
+ return;
+ if (m_bConverted)
+ throw std::runtime_error("already added to a container");
+ pCont->Add(m_pXFTable.get());
+ m_bConverted = true;
+}
+
+/**
+ * @short convert heading row
+ * @param pXFTable - pointer of table
+ * @param nStartRow - start heading row ID
+ * @param nEndRow - end heading row ID
+ */
+sal_uInt16 LwpTableLayout::ConvertHeadingRow(
+ rtl::Reference<XFTable> const & pXFTable, sal_uInt16 nStartHeadRow, sal_uInt16 nEndHeadRow)
+{
+ sal_uInt16 nContentRow;
+ LwpTable* pTable = GetTable();
+ assert(pTable);
+ sal_uInt8 nCol = static_cast<sal_uInt8>(pTable->GetColumn());
+ rtl::Reference<XFTable> pTmpTable( new XFTable );
+
+ ConvertTable(pTmpTable.get(),nStartHeadRow,nEndHeadRow,0,nCol);
+
+ sal_uInt16 nRowNum = pTmpTable->GetRowCount();
+ std::vector<sal_uInt8> CellMark(nRowNum);
+
+ if (nRowNum == 1)
+ {
+ XFRow* pXFRow = pTmpTable->GetRow(1);
+ pXFTable->AddHeaderRow(pXFRow);
+ pTmpTable->RemoveRow(1);
+ nContentRow = nEndHeadRow;
+ }
+ else
+ {
+ sal_uInt8 nFirstColSpann = 1;
+ const bool bFindFlag = FindSplitColMark(pTmpTable.get(), CellMark, nFirstColSpann);
+
+ if (bFindFlag)//split to 2 cells
+ {
+ SplitRowToCells(pTmpTable.get(), pXFTable, nFirstColSpann, CellMark.data());
+ nContentRow = nEndHeadRow;
+ }
+ else//can not split,the first row will be the heading row,the rest will be content row
+ {
+ XFRow* pXFRow = pTmpTable->GetRow(1);
+ pXFTable->AddHeaderRow(pXFRow);
+ pTmpTable->RemoveRow(1);
+ auto iter = m_RowsMap.find(0);
+ if (iter == m_RowsMap.end())
+ {
+ SAL_WARN("lwp", "row 0 is unknown");
+ nContentRow = 0;
+ }
+ else
+ nContentRow = iter->second->GetCurMaxSpannedRows(0,nCol);
+ }
+ }
+ return nContentRow;
+}
+
+void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable> const & pXFTable,
+ sal_uInt8 nFirstColSpann,const sal_uInt8* pCellMark)
+{
+ sal_uInt16 i;
+ sal_uInt16 nRowNum = pTmpTable->GetRowCount();
+ LwpTable* pTable = GetTable();
+ assert(pTable);
+ sal_uInt8 nCol = static_cast<sal_uInt8>(pTable->GetColumn());
+
+ rtl::Reference<XFRow> xXFRow(new XFRow);
+
+ //register style for heading row
+ double fHeight = 0;
+ OUString styleName;
+ std::unique_ptr<XFRowStyle> xRowStyle(new XFRowStyle);
+ XFRow* pRow = pTmpTable->GetRow(1);
+ if (!pRow)
+ throw std::runtime_error("missing row");
+ styleName = pRow->GetStyleName();
+
+ // get settings of the row and assign them to new row style
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ XFRowStyle *pTempRowStyle = static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(styleName));
+ if (pTempRowStyle)
+ *xRowStyle = *pTempRowStyle;
+
+ for (i=1;i<=nRowNum;i++)
+ {
+ styleName = pTmpTable->GetRow(i)->GetStyleName();
+ fHeight+=static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(styleName))->GetRowHeight();
+ }
+ if (m_nDirection & 0x0030)
+ {
+ xRowStyle->SetMinRowHeight(static_cast<float>(fHeight));
+ }
+ else
+ {
+ xRowStyle->SetRowHeight(static_cast<float>(fHeight));
+ }
+ xXFRow->SetStyleName(pXFStyleManager->AddStyle(std::move(xRowStyle)).m_pStyle->GetStyleName());
+
+ //construct heading row
+ rtl::Reference<XFCell> xXFCell1(new XFCell);
+ rtl::Reference<XFCell> xXFCell2(new XFCell);
+ rtl::Reference<XFTable> xSubTable1(new XFTable);
+ rtl::Reference<XFTable> xSubTable2(new XFTable);
+ XFRow* pOldRow;
+ rtl::Reference<XFCell> xNewCell;
+
+ for (i=1;i<=nRowNum;i++)
+ {
+ pOldRow = pTmpTable->GetRow(i);
+ rtl::Reference<XFRow> xNewRow(new XFRow);
+ xNewRow->SetStyleName(pOldRow->GetStyleName());
+ for (sal_uInt8 j=1;j<=pCellMark[i];j++)
+ {
+ xNewCell = pOldRow->GetCell(j);
+ xNewRow->AddCell(xNewCell);
+ }
+ xSubTable1->AddRow(xNewRow);
+ }
+ ConvertColumn(xSubTable1.get(), 0, nFirstColSpann);//add column info
+
+ xXFCell1->Add(xSubTable1.get());
+ xXFCell1->SetColumnSpaned(nFirstColSpann);
+ xXFRow->AddCell(xXFCell1);
+
+ for (i=1;i<=nRowNum;i++)
+ {
+ pOldRow = pTmpTable->GetRow(i);
+ rtl::Reference<XFRow> xNewRow(new XFRow);
+ xNewRow->SetStyleName(pOldRow->GetStyleName());
+ for(sal_Int32 j=pCellMark[i]+1;j<=pOldRow->GetCellCount();j++)
+ {
+ xNewCell = pOldRow->GetCell(j);
+ xNewRow->AddCell(xNewCell);
+ }
+ xSubTable2->AddRow(xNewRow);
+
+ }
+ ConvertColumn(xSubTable2.get(), nFirstColSpann, nCol);//add column info
+ xXFCell2->Add(xSubTable2.get());
+ xXFCell2->SetColumnSpaned(nCol-nFirstColSpann);
+ xXFRow->AddCell(xXFCell2);
+
+ pXFTable->AddHeaderRow(xXFRow.get());
+
+ //remove tmp table
+ for (i=1;i<=nRowNum;i++)
+ {
+ pOldRow = pTmpTable->GetRow(i);
+ for(sal_Int32 j=1;j<=pOldRow->GetCellCount();j++)
+ pOldRow->RemoveCell(j);
+ pTmpTable->RemoveRow(i);
+ }
+}
+
+/**
+ * @short find if the heading rows can be split to 2 cells
+ * @param pXFTable - pointer of tmp XFtable
+ * @param CellMark - pointer of cell mark array
+ */
+bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, std::vector<sal_uInt8>& rCellMark,
+ sal_uInt8& nMaxColSpan)
+{
+ sal_uInt16 nRowNum = pXFTable->GetRowCount();
+ sal_uInt8 nColNum = static_cast<sal_uInt8>(pXFTable->GetColumnCount());
+ sal_uInt8 nCount;
+ sal_uInt8 nColSpan;
+ bool bFindFlag = false;
+ XFRow* pTmpRow;
+
+ for(sal_uInt8 i=1;i<=nColNum;i++)
+ {
+ sal_uInt16 nRowLoop;
+
+ //find current max column span
+ nMaxColSpan = 1;
+ for (nRowLoop=1;nRowLoop<=nRowNum;nRowLoop++)
+ {
+ nColSpan = 0;
+ for(sal_uInt8 nCellLoop=1; nCellLoop<i+1; nCellLoop++)
+ {
+ pTmpRow = pXFTable->GetRow(nRowLoop);
+ XFCell* pCell = pTmpRow->GetCell(nCellLoop);
+ if (pCell)
+ nColSpan += static_cast<sal_uInt8>(pCell->GetColSpaned());
+ else
+ return false;
+ }
+ if (nColSpan > nMaxColSpan)
+ nMaxColSpan = nColSpan;
+ rCellMark.at(nRowLoop) = 0;//reset all cell mark to zero
+ }
+
+ //find if other row has the same column
+ for (nRowLoop=1;nRowLoop<=nRowNum;nRowLoop++)
+ {
+ pTmpRow = pXFTable->GetRow(nRowLoop);
+ nCount = 0;
+ sal_Int32 nCellMark = 0;
+ for (sal_Int32 nCellLoop=1; nCellLoop<=pTmpRow->GetCellCount(); nCellLoop++)
+ {
+ if (nCount>nMaxColSpan)
+ break;
+ nCount+= static_cast<sal_uInt8>(pTmpRow->GetCell(nCellLoop)->GetColSpaned());
+ if (nCount == nMaxColSpan)
+ {
+ nCellMark = nCellLoop;
+ break;
+ }
+ }
+ if (nCellMark == 0)
+ break;
+ else
+ rCellMark.at(nRowLoop) = nCellMark;
+ }
+ for(nRowLoop=1;nRowLoop<=nRowNum;nRowLoop++)//check if all ==0,break
+ {
+ if (rCellMark.at(nRowLoop) == 0)
+ break;
+ }
+ if (nRowLoop == nRowNum+1)
+ {
+ bFindFlag = true;
+ return bFindFlag;
+ }
+
+ }
+ return bFindFlag;
+}
+
+static bool operator==(const TableConvertAttempt& a, const TableConvertAttempt& b)
+{
+ return a.mnStartRow == b.mnStartRow &&
+ a.mnEndRow == b.mnEndRow &&
+ a.mnStartCol== b.mnStartCol &&
+ a.mnEndCol == b.mnEndCol;
+}
+
+/**
+ * @short convert word pro table to SODC table
+ * @param pXFTable - pointer of table
+ * @param nStartRow - start row ID
+ * @param nEndRow - end row ID
+ * @param nStartCol - start column ID
+ * @param nEndCol - end column ID
+ */
+void LwpTableLayout::ConvertTable(rtl::Reference<XFTable> const & pXFTable, sal_uInt16 nStartRow,
+ sal_uInt16 nEndRow,sal_uInt8 nStartCol,sal_uInt8 nEndCol)
+{
+ TableConvertAttempt aConversionAttempt(nStartRow, nEndRow, nStartCol, nEndCol);
+ auto itr = std::find(m_aConvertingStack.begin(), m_aConvertingStack.end(), aConversionAttempt);
+ if (itr != m_aConvertingStack.end())
+ {
+ SAL_WARN("lwp", "already trying to convert this range");
+ return;
+ }
+
+ m_aConvertingStack.push_back(aConversionAttempt);
+
+ //out put column info TO BE CHANGED
+ ConvertColumn(pXFTable,nStartCol,nEndCol);
+
+ std::map<sal_uInt16,LwpRowLayout*>::iterator iter;
+
+ for (sal_uInt16 i=nStartRow; i<nEndRow;)
+ {
+ iter = m_RowsMap.find(i);
+ if (iter == m_RowsMap.end())
+ {
+ ConvertDefaultRow(pXFTable,nStartCol,nEndCol,i);
+ i++;
+ }
+ else
+ {
+ LwpRowLayout* pRow = iter->second;
+ if (pRow->GetCurMaxSpannedRows(nStartCol,nEndCol) == 1)
+ {
+ pRow->ConvertCommonRow(pXFTable,nStartCol,nEndCol);
+ i++;
+ }
+ else
+ {
+ pRow->ConvertRow(pXFTable,nStartCol,nEndCol);
+ i += pRow->GetCurMaxSpannedRows(nStartCol,nEndCol);
+ }
+ }
+ }
+
+ m_aConvertingStack.pop_back();
+}
+
+/**
+ * @short apply numeric value and formula to cell
+ * @param pFoundry - pointer of foundry
+ * @param aTableID - table ID
+ */
+void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
+{
+
+ // The old code doesn't check if the LwpFoundry pointer is NULL, so the NULL
+ // pointer cause sodc frozen. Add code to check the pointer.
+ if( !pFoundry ) return;
+
+ try{
+
+ LwpDLVListHeadHolder* pHolder = dynamic_cast<LwpDLVListHeadHolder*>(pFoundry->GetNumberManager().GetTableRangeID().obj().get());
+
+ LwpTableRange* pTableRange = pHolder ? dynamic_cast<LwpTableRange*>(pHolder->GetHeadID().obj().get()) : nullptr;
+
+ //Look up the table
+ o3tl::sorted_vector<LwpTableRange*> aTableSeen;
+ while (pTableRange)
+ {
+ aTableSeen.insert(pTableRange);
+ LwpObjectID aID = pTableRange->GetTableID();
+ if (aID == aTableID)
+ {
+ break;
+ }
+ pTableRange = pTableRange->GetNext();
+ if (aTableSeen.find(pTableRange) != aTableSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+
+ if (!pTableRange)
+ return;
+
+ LwpCellRange* pRange = dynamic_cast<LwpCellRange*>(pTableRange->GetCellRangeID().obj().get());
+ if (!pRange)
+ return;
+
+ LwpFolder* pFolder = dynamic_cast<LwpFolder*>(pRange->GetFolderID().obj().get());
+ if (!pFolder)
+ return;
+
+ LwpObjectID aRowListID = pFolder->GetChildHeadID();
+ LwpRowList* pRowList = dynamic_cast<LwpRowList*>(aRowListID.obj().get());
+
+ //loop the rowlist
+ o3tl::sorted_vector<LwpRowList*> aOuterSeen;
+ while (pRowList)
+ {
+ aOuterSeen.insert(pRowList);
+ sal_uInt16 nRowID = pRowList->GetRowID();
+ {
+ LwpCellList* pCellList = dynamic_cast<LwpCellList*>(pRowList->GetChildHeadID().obj().get());
+ //loop the cellList
+ o3tl::sorted_vector<LwpCellList*> aSeen;
+ while (pCellList)
+ {
+ aSeen.insert(pCellList);
+ {//put cell
+ sal_uInt16 nColID = pCellList->GetColumnID();
+
+ XFCell* pCell = GetCellsMap(nRowID,static_cast<sal_uInt8>(nColID));
+ if (!pCell)
+ {
+ throw std::runtime_error("Hidden cell would not be in cellsmap");
+ }
+
+ pCellList->Convert(pCell, this);
+
+ //process paragraph
+ PostProcessParagraph(pCell, nRowID, nColID);
+
+ }
+ pCellList = dynamic_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
+ if (aSeen.find(pCellList) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+ }
+ pRowList = dynamic_cast<LwpRowList*>(pRowList->GetNextID().obj().get());
+ if (aOuterSeen.find(pRowList) != aOuterSeen.end())
+ throw std::runtime_error("loop in conversion");
+ }
+
+ }catch (...) {
+ SAL_WARN("lwp", "bad PutCellVals");
+ }
+}
+
+/**
+ * @short 1. set number right alignment to right if number 2. remove tab added before if number
+ * @param pCell - cell which to be process
+ * @param nRowID - row number in Word Pro file
+ * @param nColID - column number in Word Pro file
+ */
+void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_uInt16 nColID)
+{
+ // if number right, set alignment to right
+ LwpCellLayout * pCellLayout = GetCellByRowCol(nRowID, nColID);
+ if(!pCellLayout)
+ return;
+
+ rtl::Reference<XFContent> first(
+ pCell->FindFirstContent(enumXFContentPara));
+ XFParagraph * pXFPara = static_cast<XFParagraph*>(first.get());
+ if (!pXFPara)
+ return;
+ XFColor aNullColor;
+
+ OUString sNumfmt = pCellLayout->GetNumfmtName();
+ bool bColorMod = false;
+ XFNumberStyle* pNumStyle = nullptr;
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ if (!sNumfmt.isEmpty())
+ {
+ pNumStyle = static_cast<XFNumberStyle*>(pXFStyleManager->FindStyle(sNumfmt));
+ XFColor aColor = pNumStyle->GetColor();
+ if ( aColor != aNullColor )
+ bColorMod = true;//end
+ }
+
+ XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
+ if (!((pStyle && pStyle->GetNumberRight()) || bColorMod))
+ return;
+
+ std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
+
+ if (pStyle)
+ {
+ *xOverStyle = *pStyle;
+
+ if (pStyle->GetNumberRight())
+ xOverStyle->SetAlignType(enumXFAlignEnd);
+ }
+
+ if (bColorMod)
+ {
+ rtl::Reference<XFFont> xFont = xOverStyle->GetFont();
+ if (xFont.is())
+ {
+ XFColor aColor = xFont->GetColor();
+ if (aColor == aNullColor)
+ {
+ rtl::Reference<XFFont> pNewFont(new XFFont);
+ aColor = pNumStyle->GetColor();
+ pNewFont->SetColor(aColor);
+ xOverStyle->SetFont(pNewFont);
+ }
+ }
+ }
+
+ xOverStyle->SetStyleName("");
+ OUString StyleName
+ = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+
+ pXFPara->SetStyleName(StyleName);
+}
+
+/**
+ * @short Parse all cols of table
+ * @param pXFTable - pointer to created XFTable
+ */
+void LwpTableLayout::ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol, sal_uInt8 nEndCol)
+{
+ LwpTable * pTable = GetTable();
+ if (!pTable)
+ {
+ assert(false);
+ return;
+ }
+
+ for (sal_uInt32 iLoop = 0; iLoop < static_cast<sal_uInt32>(nEndCol)-nStartCol; ++iLoop)
+ {
+ // add row to table
+ LwpObjectID *pColID = &GetColumnLayoutHead();
+ LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj().get());
+ while (pColumnLayout)
+ {
+ if (pColumnLayout->GetColumnID() == (iLoop+nStartCol))
+ {
+ pXFTable->SetColumnStyle(iLoop+1, pColumnLayout->GetStyleName());
+ break;
+ }
+ pColID = &pColumnLayout->GetNext();
+ pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj().get());
+ }
+ if (!pColumnLayout)
+ {
+ pXFTable->SetColumnStyle(iLoop+1, m_DefaultColumnStyleName);
+ }
+ }
+}
+/**
+ * @short split conflict merged cells
+ */
+void LwpTableLayout::SplitConflictCells()
+{
+ LwpTable * pTable = GetTable();
+ if (!pTable)
+ return;
+ sal_uInt16 nCol = pTable->GetColumn();
+ sal_uInt16 nRow = pTable->GetRow();
+
+ sal_uInt16 nEffectRows;
+ std::map<sal_uInt16,LwpRowLayout*>::iterator iter1;
+ std::map<sal_uInt16,LwpRowLayout*>::iterator iter2;
+ LwpRowLayout* pRowLayout;
+ LwpRowLayout* pEffectRow;
+
+ for (sal_uInt16 i=0; i<nRow; )
+ {
+ iter1 = m_RowsMap.find(i);
+ if (iter1 == m_RowsMap.end())//default rows
+ {
+ i++;
+ continue;
+ }
+ pRowLayout= iter1->second;
+ if (!pRowLayout->GetMergeCellFlag())
+ {
+ i++;
+ continue;
+ }
+ else
+ {
+ nEffectRows = i + pRowLayout->GetCurMaxSpannedRows(0,static_cast<sal_uInt8>(nCol));
+
+ for (sal_uInt16 j = i+1; j<nEffectRows; j++)
+ {
+ iter2 = m_RowsMap.find(j);
+ if (iter2 == m_RowsMap.end())
+ continue;
+ pEffectRow = iter2->second;
+ if (!pEffectRow->GetMergeCellFlag())
+ continue;
+ else
+ pEffectRow->SetCellSplit(nEffectRows);
+ }
+ i = nEffectRows;
+ }
+ }//end for
+
+}
+/**
+ * @short add default row which are missing in the file
+ * @param pXFTable - pointer to new created table
+ * @param nStartCol - starting column
+ * @param nEndCol - end column
+ * @return pXFTable
+ */
+void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol,
+ sal_uInt8 nEndCol, sal_uInt16 nRowID)
+{
+ // current row doesn't exist in the file
+ rtl::Reference<XFRow> xRow(new XFRow);
+ xRow->SetStyleName(m_DefaultRowStyleName);
+
+ for (sal_uInt16 j =0;j < nEndCol-nStartCol; j++)
+ {
+ // if table has default cell layout, use it to ConvertCell
+ // otherwise use blank cell
+ rtl::Reference<XFCell> xCell;
+ if (m_pDefaultCellLayout)
+ {
+ LwpTable* pTable = GetTable();
+ assert(pTable);
+ xCell = m_pDefaultCellLayout->DoConvertCell(
+ pTable->GetObjectID(),nRowID,j+nStartCol);
+ }
+ else
+ {
+ xCell.set(new XFCell);
+ }
+ xRow->AddCell(xCell);
+ }
+
+ pXFTable->AddRow(xRow);
+}
+/**
+ * @short set cell map info
+ * @param pXFCell - pointer to xfcell
+ * @param nRow - row id
+ * @param nCol - column id
+ */
+void LwpTableLayout::SetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol,XFCell* pXFCell)
+{
+ std::pair<std::pair<sal_uInt16,sal_uInt8>,XFCell*> cell;
+ std::pair<sal_uInt16,sal_uInt8> pos;
+ pos.first = nRow;
+ pos.second = nCol;
+ cell.first = pos;
+ cell.second = pXFCell;
+ m_CellsMap.insert(cell);
+}
+
+/**
+ * @short get cell map info
+ * @param nRow - row id
+ * @param nCol - column id
+ * @return pXFCell
+ */
+XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol)
+{
+ std::pair<sal_uInt16,sal_uInt8> pos;
+ pos.first = nRow;
+ pos.second = nCol;
+ auto iter = m_CellsMap.find(pos);
+ if (iter == m_CellsMap.end())
+ return nullptr;
+ return iter->second;
+}
+/**
+ * @descr Get row layout by row id
+ * @param nRow - row id
+ */
+ LwpRowLayout* LwpTableLayout::GetRowLayout(sal_uInt16 nRow)
+{
+ LwpObjectID *pRowID = &GetChildHead();
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ while (pRowLayout)
+ {
+ if(pRowLayout->GetRowID() == nRow)
+ return pRowLayout;
+
+ pRowID = &pRowLayout->GetNext();
+ pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
+ }
+ return nullptr;
+}
+
+//add end by
+LwpColumnLayout::LwpColumnLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpVirtualLayout(objHdr, pStrm)
+ , ccolid(0)
+ , cwidth(0)
+{}
+
+LwpColumnLayout::~LwpColumnLayout()
+{}
+void LwpColumnLayout::Read()
+{
+ LwpObjectStream* pStrm = m_pObjStrm.get();
+
+ LwpVirtualLayout::Read();
+
+ sal_uInt16 colid;
+
+ colid = pStrm->QuickReaduInt16(); // forced to lushort
+ ccolid = static_cast<sal_uInt8>(colid);
+ cwidth = pStrm->QuickReadInt32();
+
+ pStrm->SkipExtra();
+}
+
+void LwpColumnLayout::RegisterStyle(double dCalculatedWidth)
+{
+ std::unique_ptr<XFColStyle> xColStyle(new XFColStyle);
+ xColStyle->SetWidth(static_cast<float>(dCalculatedWidth));
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xColStyle)).m_pStyle->GetStyleName();
+}
+
+LwpTableHeadingLayout::LwpTableHeadingLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpTableLayout(objHdr, pStrm)
+ , cStartRow(0)
+ , cEndRow(0)
+{}
+
+LwpTableHeadingLayout::~LwpTableHeadingLayout()
+{}
+/**
+ * @short read table heading layout
+ * @param
+ * @return
+ */
+void LwpTableHeadingLayout::Read()
+{
+ LwpTableLayout::Read();
+
+ cStartRow = m_pObjStrm->QuickReaduInt16();
+ cEndRow = m_pObjStrm->QuickReaduInt16();
+
+ m_pObjStrm->SkipExtra();
+
+}
+/**
+ * @short get start and end row number of table heading
+ * @param
+ * @return *pStartRow - starting row number
+ * @return *pEndRow - end row number
+ */
+void LwpTableHeadingLayout::GetStartEndRow(sal_uInt16& nStartRow, sal_uInt16& nEndRow)
+{
+ nStartRow = cStartRow;
+ nEndRow = cEndRow;
+}
+
+LwpSuperParallelColumnLayout::LwpSuperParallelColumnLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpSuperTableLayout(objHdr, pStrm)
+{
+}
+LwpSuperParallelColumnLayout::~LwpSuperParallelColumnLayout()
+{}
+
+void LwpSuperParallelColumnLayout::Read()
+{
+ LwpSuperTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+
+}
+
+LwpSuperGlossaryLayout::LwpSuperGlossaryLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpSuperTableLayout(objHdr, pStrm)
+{
+}
+
+LwpSuperGlossaryLayout::~LwpSuperGlossaryLayout()
+{
+}
+
+void LwpSuperGlossaryLayout::Read()
+{
+ LwpSuperTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+LwpParallelColumnsLayout::LwpParallelColumnsLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpTableLayout(objHdr, pStrm)
+{
+}
+
+LwpParallelColumnsLayout::~LwpParallelColumnsLayout()
+{
+}
+
+void LwpParallelColumnsLayout::Read()
+{
+ LwpTableLayout::Read();
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx
new file mode 100644
index 000000000..9eebb2b39
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptablelayout.hxx
@@ -0,0 +1,283 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table layouts
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX
+
+#include "lwplayout.hxx"
+#include <xfilter/xftable.hxx>
+
+#include <vector>
+#include <map>
+#include <memory>
+
+class XFTableStyle;
+class XFTable;
+class XFCell;
+class LwpTable;
+class LwpFrame;
+class LwpSuperTableLayout;
+class LwpRowLayout;
+class LwpCellLayout;
+class LwpTableHeadingLayout;
+class LwpRowHeadingLayout;
+class LwpConnectedCellLayout;
+class LwpColumnLayout;
+
+struct TableConvertAttempt
+{
+ sal_uInt16 mnStartRow;
+ sal_uInt16 mnEndRow;
+ sal_uInt8 mnStartCol;
+ sal_uInt8 mnEndCol;
+
+ TableConvertAttempt(sal_uInt16 nStartRow, sal_uInt16 nEndRow, sal_uInt8 nStartCol, sal_uInt8 nEndCol)
+ : mnStartRow(nStartRow), mnEndRow(nEndRow), mnStartCol(nStartCol), mnEndCol(nEndCol)
+ {
+ }
+};
+
+/**
+ * @brief
+ * VO_TABLELAYOUT object and functions for registering styles and converting tables
+ */
+class LwpTableLayout: public LwpLayout
+{
+public:
+ LwpTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_TABLE_LAYOUT;}
+ LwpObjectID& GetColumnLayoutHead(){return m_ColumnLayout;}
+ void RegisterStyle() override;
+ LwpTable * GetTable();
+ LwpCellLayout * GetDefaultCellLayout(){return m_pDefaultCellLayout;}
+ LwpSuperTableLayout * GetSuperTableLayout();
+ LwpObjectID * SearchCellStoryMap(sal_uInt16 nRow, sal_uInt16 nCol);
+ LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol);
+ OUString GetColumnWidth(sal_uInt16 nCol);
+ void SetWordProCellMap(sal_uInt16 nRow, sal_uInt16 nCol, LwpCellLayout * pCell)
+ {
+ if (nRow >= m_nRows || nCol >= m_nCols)
+ return;
+ m_WordProCellsMap[static_cast<size_t>(nRow) * m_nCols + nCol] = pCell;
+ };
+protected:
+ void Read() override;
+ void TraverseTable();
+ void RegisterColumns();
+ void RegisterRows();
+ void ParseTable();
+ void PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_uInt16 nColID);
+
+ sal_uInt16 m_nRows;
+ sal_uInt16 m_nCols;
+
+ std::vector<TableConvertAttempt> m_aConvertingStack;
+
+private:
+ //CColumnLayoutHead cColumnLayout;
+ LwpObjectID m_ColumnLayout;
+ LwpCellLayout * m_pDefaultCellLayout;
+ OUString m_DefaultColumnStyleName;
+ OUString m_DefaultRowStyleName;
+
+ // wordpro cell map
+ std::vector<LwpCellLayout*> m_WordProCellsMap;
+ // column vector
+ std::vector<LwpColumnLayout*> m_aColumns;
+
+public:
+ void XFConvert(XFContentContainer* pCont) override;
+ void ConvertTable(rtl::Reference<XFTable> const & pXFTable, sal_uInt16 nStartRow,
+ sal_uInt16 nEndRow,sal_uInt8 nStartCol,sal_uInt8 nEndCol);
+ const OUString& GetDefaultRowStyleName() const {return m_DefaultRowStyleName;}
+ void SetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol,XFCell* pXFCell);
+ XFCell* GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol);
+ const std::map<sal_uInt16,LwpRowLayout*>& GetRowsMap() const {return m_RowsMap;}
+ LwpRowLayout* GetRowLayout(sal_uInt16 nRow);
+private:
+ void ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol,
+ sal_uInt8 nEndCol, sal_uInt16 nRowID);
+ void ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol, sal_uInt8 nEndCol);
+ sal_uInt16 ConvertHeadingRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt16 nStartHeadRow,sal_uInt16 nEndHeadRow);
+ static bool FindSplitColMark(XFTable* pXFTable, std::vector<sal_uInt8>& rCellMark, sal_uInt8& nMaxColSpan);
+ void SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable> const & pXFTable,
+ sal_uInt8 nFirstColSpann, const sal_uInt8* pCellMark);
+
+ std::map<sal_uInt16,LwpRowLayout*> m_RowsMap;
+ void SplitConflictCells();
+ rtl::Reference<XFTable> m_pXFTable;
+ bool m_bConverted;
+ std::map<std::pair<sal_uInt16,sal_uInt8>,XFCell*> m_CellsMap;
+
+ void PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID);
+};
+/**
+ * @brief
+ * VO_SUPERTABLELAYOUT object
+ */
+class LwpSuperTableLayout: public LwpPlacableLayout
+{
+public:
+ LwpSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpSuperTableLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_SUPERTABLE_LAYOUT;}
+ void RegisterNewStyle();
+ // for table style
+ void ApplyPatternFill(XFTableStyle* pTableStyle);
+ void ApplyBackGround(XFTableStyle* pTableStyle);
+
+ void ApplyBackColor(XFTableStyle *pTableStyle);
+ void ApplyShadow(XFTableStyle *pTableStyle);
+ double GetWidth() override;
+ double GetTableWidth();
+ void ApplyWatermark(XFTableStyle *pTableStyle);
+ void ApplyAlignment(XFTableStyle * pTableStyle);
+ void XFConvert(XFContentContainer* pCont) override;
+ // for frame style
+ virtual void XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart = 0, sal_Int32 nEnd = 0, bool bAll = false) override;
+ void RegisterFrameStyle();
+ LwpTableHeadingLayout* GetTableHeadingLayout();
+protected:
+ void Read() override;
+ LwpTableLayout* GetTableLayout();
+ bool IsSizeRightToContent();
+ bool IsJustifiable();
+ std::unique_ptr<LwpFrame> m_pFrame;
+};
+
+/**
+ * @brief
+ * VO_COLUMNLAYOUT object
+ */
+class LwpColumnLayout : public LwpVirtualLayout
+{
+public:
+ LwpColumnLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpColumnLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_COLUMN_LAYOUT;}
+ sal_uInt32 GetColumnID() const {return ccolid;}
+ double GetWidth() override {return LwpTools::ConvertFromUnitsToMetric(cwidth);}
+ using LwpVirtualLayout::RegisterStyle;
+ void RegisterStyle(double dCalculatedWidth);
+ bool IsJustifiable() const {return (( m_nAttributes2 & STYLE2_JUSTIFIABLE) != 0);}
+protected:
+ void Read() override;
+private:
+ sal_uInt8 ccolid;
+ sal_Int32 cwidth;
+
+};
+/**
+ * @brief
+ * VO_TABLEHEADINGLAYOUT object
+ */
+class LwpTableHeadingLayout : public LwpTableLayout
+{
+public:
+ LwpTableHeadingLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpTableHeadingLayout() override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_TABLE_HEADING_LAYOUT;}
+ void GetStartEndRow(sal_uInt16& nStartRow, sal_uInt16& nEndRow);
+protected:
+ void Read() override;
+private:
+ sal_uInt16 cStartRow;
+ sal_uInt16 cEndRow;
+};
+/**
+ * @brief
+ * VO_SUPERPARALLELCOLUMNLAYOUT object
+ */
+class LwpSuperParallelColumnLayout : public LwpSuperTableLayout
+{
+public:
+ LwpSuperParallelColumnLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpSuperParallelColumnLayout() override;
+protected:
+ void Read() override;
+};
+
+/**
+ * @brief
+ * VO_PCOLLAYOUT object
+ */
+class LwpParallelColumnsLayout : public LwpTableLayout
+{
+public:
+ LwpParallelColumnsLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpParallelColumnsLayout() override;
+protected:
+ void Read() override;
+};
+
+class LwpSuperGlossaryLayout : public LwpSuperTableLayout
+{
+public:
+ LwpSuperGlossaryLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpSuperGlossaryLayout() override;
+protected:
+ void Read() override;
+};
+
+#include "lwpcelllayout.hxx"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptaboverride.cxx b/lotuswordpro/source/filter/lwptaboverride.cxx
new file mode 100644
index 000000000..2401b35f0
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptaboverride.cxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "lwptaboverride.hxx"
+
+LwpTabOverride::LwpTabOverride(LwpTabOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_aTabRackID(rOther.m_aTabRackID)
+{
+}
+
+LwpTabOverride* LwpTabOverride::clone() const
+{
+ return new LwpTabOverride(*this);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptaboverride.hxx b/lotuswordpro/source/filter/lwptaboverride.hxx
new file mode 100644
index 000000000..a2ea4b487
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptaboverride.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tab override for VO_PARASTYLE.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABOVERRIDE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABOVERRIDE_HXX
+
+#include <lwpoverride.hxx>
+#include <lwpobjid.hxx>
+
+class LwpTabOverride final : public LwpOverride
+{
+public:
+ LwpTabOverride()
+ {
+ }
+
+ virtual LwpTabOverride* clone() const override;
+
+ virtual void Read(LwpObjectStream *pStrm) override
+ {
+ if (pStrm->QuickReadBool())
+ {
+ ReadCommon(pStrm);
+ m_aTabRackID.ReadIndexed(pStrm);
+ }
+
+ pStrm->SkipExtra();
+ }
+
+ inline LwpObjectID& GetTabRackID();
+ inline void Override(LwpTabOverride* pOther);
+
+private:
+ LwpTabOverride(LwpTabOverride const& rOther);
+ LwpTabOverride& operator=(LwpTabOverride const& rOther) = delete;
+
+ LwpObjectID m_aTabRackID;
+ enum
+ {
+ TO_TABRACK = 0x01
+ };
+};
+
+inline LwpObjectID& LwpTabOverride::GetTabRackID()
+{
+ return m_aTabRackID;
+}
+
+inline void LwpTabOverride::Override(LwpTabOverride* pOther)
+{
+ if (m_nApply & TO_TABRACK)
+ {
+ if ((m_nOverride & TO_TABRACK) != 0)
+ pOther->m_aTabRackID = GetTabRackID();
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx
new file mode 100644
index 000000000..84a80decd
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptabrack.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tabrack for LwpTabPiece object.
+ ************************************************************************/
+#include "lwptabrack.hxx"
+#include <lwpobjstrm.hxx>
+
+#include <stdexcept>
+
+LwpTab::LwpTab()
+ : m_nX(0),
+ m_nType(0),
+ m_nLeader(0),
+ m_nRelativeType(0),
+ m_nAlignChar(0) //be careful,not quite sure it's 8-bit,perhaps 16-bit.
+{
+}
+
+void LwpTab::Read(LwpObjectStream *pStrm)
+{
+ m_nX = pStrm->QuickReaduInt32();
+ m_nType = pStrm->QuickReaduInt8();
+ m_nLeader = pStrm->QuickReaduInt8();
+ m_nRelativeType = pStrm->QuickReaduInt8();
+ m_nAlignChar = pStrm->QuickReaduInt16();
+}
+
+LwpTabRack::LwpTabRack(LwpObjectHeader objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr,pStrm),
+ m_nNumTabs(0)
+{
+}
+
+void LwpTabRack::Read()
+{
+ m_NextID.ReadIndexed(m_pObjStrm.get());
+
+ m_nNumTabs = m_pObjStrm->QuickReaduInt16();
+ if (m_nNumTabs > MaxTabs)
+ throw std::range_error("corrupt LwpTabRack");
+ for (int i=0; i<m_nNumTabs; ++i)
+ {
+ m_aTabs[i].Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+ m_pObjStrm->SkipExtra();
+}
+
+LwpTab* LwpTabRack::Lookup(sal_uInt16 nIndex)
+{
+ /* Is the tab in this tabrack? */
+ if(nIndex<m_nNumTabs)
+ {
+ return &m_aTabs[nIndex];
+ }
+ //return NULL;
+ /* It's not in this tabrack, so get it out of our next. */
+ if (!GetNext())
+ return nullptr; /* ouch */
+
+ return GetNext()->Lookup(nIndex - m_nNumTabs);
+}
+
+LwpTabRack* LwpTabRack::GetNext()
+{
+ LwpTabRack* pTabRack = dynamic_cast<LwpTabRack*>(m_NextID.obj().get());
+ return pTabRack;
+}
+
+sal_uInt16 LwpTabRack::GetNumTabs()
+{
+ sal_uInt16 nNum=0;
+ if(GetNext())
+ {
+ nNum = GetNext()->GetNumTabs();
+ }
+ return m_nNumTabs+nNum;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptabrack.hxx b/lotuswordpro/source/filter/lwptabrack.hxx
new file mode 100644
index 000000000..7157e08ab
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptabrack.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tabrack for LwpTabPiece object.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABRACK_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABRACK_HXX
+
+#include <lwpobj.hxx>
+
+class LwpObjectStream;
+class LwpTab;
+class LwpTabRack;
+
+class LwpTab
+{
+public:
+ LwpTab();
+
+ enum TabType
+ {
+ TT_LEFT = 1,
+ TT_CENTER,
+ TT_RIGHT,
+ TT_NUMERIC
+ };
+
+ enum LeaderType
+ {
+ TL_NONE = 0,
+ TL_HYPHEN,
+ TL_DOT,
+ TL_LINE
+ };
+
+ enum RelativeType
+ {
+ TR_LEFT = 1,
+ TR_RIGHT,
+ TR_CENTER
+ };
+public:
+ void Read(LwpObjectStream *pStrm);
+ inline sal_uInt32 GetPosition() const;
+ sal_uInt8 GetTabType() const
+ {
+ return m_nType;
+ }
+ sal_uInt8 GetLeaderType() const
+ {
+ return m_nLeader;
+ }
+ sal_uInt16 GetAlignChar() const
+ {
+ return m_nAlignChar;
+ }
+private:
+ sal_uInt32 m_nX;
+ sal_uInt8 m_nType;
+ sal_uInt8 m_nLeader;
+ sal_uInt8 m_nRelativeType;
+ sal_uInt16 m_nAlignChar; //be careful
+};
+
+inline sal_uInt32 LwpTab::GetPosition() const
+{
+ return m_nX;
+}
+
+class LwpTabRack : public LwpObject
+{
+public:
+ LwpTabRack(LwpObjectHeader objHdr, LwpSvStream* pStrm);
+public:
+ void Read() override;
+ sal_uInt16 GetNumTabs();
+ LwpTab* Lookup(sal_uInt16 nIndex);
+ LwpTabRack* GetNext();
+private:
+ virtual ~LwpTabRack() override {}
+
+ enum{
+ MaxTabs = 15
+ };
+ sal_uInt16 m_nNumTabs;
+ LwpTab m_aTabs[MaxTabs];
+ LwpObjectID m_NextID;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptblcell.cxx b/lotuswordpro/source/filter/lwptblcell.cxx
new file mode 100644
index 000000000..1de069757
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptblcell.cxx
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table cell numerics format
+ */
+
+#include <lwpfilehdr.hxx>
+#include <lwpoverride.hxx>
+#include <lwpobjid.hxx>
+#include "lwptblcell.hxx"
+#include "lwppara.hxx"
+
+ LwpCellList::LwpCellList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm)
+ , cColumn(0)
+{}
+
+LwpCellList::~LwpCellList()
+{}
+
+void LwpCellList::Read()
+{
+ // CDLFVList read construction
+ LwpDLVList::Read();
+
+ LwpDLVListHeadTail cChild;
+ cChild.Read(m_pObjStrm.get());
+
+ cParent.ReadIndexed(m_pObjStrm.get());
+
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ m_pObjStrm->SkipExtra();
+
+ cValue.ReadIndexed(m_pObjStrm.get());
+
+ LwpObjectID cDependent;
+ cDependent.ReadIndexed(m_pObjStrm.get());
+
+ cColumn = static_cast<sal_uInt8>(m_pObjStrm->QuickReaduInt16()); // written as a sal_uInt16
+// sal_uInt8 cCellFlags = (sal_uInt8) m_pObjStrm->QuickReaduInt16(); // written as a sal_uInt16
+ m_pObjStrm->SeekRel(2);//CellFlags
+ m_pObjStrm->SkipExtra();
+
+}
+
+void LwpCellList::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+void LwpCellList::Convert(XFCell * pCell, LwpTableLayout* /*pCellsMap*/)
+{
+ LwpObjectID aValueID = cValue;
+ LwpNumericValue* pValue = dynamic_cast<LwpNumericValue*>(aValueID.obj().get());
+ if (pValue)
+ {
+ pCell->SetValue( pValue->GetValue() );
+ }
+}
+
+LwpNumericValue::LwpNumericValue(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+ , cNumber(0)
+{}
+
+LwpNumericValue::~LwpNumericValue()
+{}
+
+void LwpNumericValue::Read()
+{
+ cNumber = m_pObjStrm->QuickReadDouble();
+ m_pObjStrm->SkipExtra();
+
+}
+
+void LwpNumericValue::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+LwpRowList::LwpRowList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm)
+ , cRowID(0)
+{}
+
+LwpRowList::~LwpRowList()
+{}
+
+void LwpRowList::Read()
+{
+ // CDLFVList read construction
+ LwpDLVList::Read();
+
+ cChild.Read(m_pObjStrm.get());
+ cParent.ReadIndexed(m_pObjStrm.get());
+
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ m_pObjStrm->SkipExtra();
+
+ cRowID = m_pObjStrm->QuickReaduInt16();
+
+ m_pObjStrm->SkipExtra();
+}
+ void LwpRowList::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+LwpTableRange::LwpTableRange(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ :LwpDLVList(objHdr, pStrm)
+{}
+
+LwpTableRange::~LwpTableRange()
+{}
+
+void LwpTableRange::Read()
+{
+ LwpDLVList::Read();
+
+ cqTable.ReadIndexed(m_pObjStrm.get());
+ cpCellRange.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpTableRange::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+ LwpCellRange::LwpCellRange(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpObject(objHdr, pStrm)
+{}
+
+LwpCellRange::~LwpCellRange()
+{}
+
+void LwpCellRange::Read()
+{
+ cpFolder.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpCellRange::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+ LwpFolder::LwpFolder(LwpObjectHeader const &objHdr, LwpSvStream* pStrm):LwpDLVList(objHdr, pStrm)
+{}
+
+LwpFolder::~LwpFolder()
+{}
+
+void LwpFolder::Read()
+{
+ // CDLFVList read construction
+ LwpDLVList::Read();
+
+ cChild.Read(m_pObjStrm.get());
+ cParent.ReadIndexed(m_pObjStrm.get());
+
+ if (LwpFileHeader::m_nFileRevision < 0x0006)
+ m_pObjStrm->SkipExtra();
+
+ cqTable.ReadIndexed(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpFolder::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+LwpDependent::LwpDependent(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm)
+ , cReferenceOffset(0)
+ , cFlags(0)
+{}
+
+LwpDependent::~LwpDependent()
+{}
+
+void LwpDependent::Read()
+{
+ LwpDLVList::Read();
+
+ cFormulaInfo.ReadIndexed(m_pObjStrm.get());
+ cReferenceOffset = m_pObjStrm->QuickReaduInt16();
+ cFlags = static_cast<sal_uInt8>(m_pObjStrm->QuickReaduInt16()); // Written as lushort.
+
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpDependent::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+void LwpRowSpecifier::QuickRead(LwpObjectStream *pStrm)
+{
+ cRow = pStrm->QuickReaduInt16();
+ cQualifier.QuickRead(pStrm);
+}
+void LwpColumnSpecifier::QuickRead(LwpObjectStream *pStrm)
+{
+ cColumn = static_cast<sal_uInt8>(pStrm->QuickReaduInt16());
+ cQualifier.QuickRead(pStrm);
+}
+
+void LwpRowColumnQualifier::QuickRead(LwpObjectStream *pStrm)
+{
+ // written as lushort for future flags
+ cFlags = static_cast<sal_uInt8>(pStrm->QuickReaduInt16());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptblcell.hxx b/lotuswordpro/source/filter/lwptblcell.hxx
new file mode 100644
index 000000000..e9def931b
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptblcell.hxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table object
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTBLCELL_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTBLCELL_HXX
+
+#include <lwpobj.hxx>
+#include "lwpdlvlist.hxx"
+
+#include <xfilter/xfcell.hxx>
+
+// temporarily added for compile
+class LwpObject;
+
+class LwpContent;
+class LwpTableLayout;
+/**
+ * @brief
+ * VO_CELLLIST object
+ */
+class LwpCellList : public LwpDLVList
+{
+public:
+ LwpCellList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ virtual void Parse(IXFStream* pOutputStream) override;
+ LwpObjectID const & GetNextID(){return GetNext();}
+ sal_uInt8 GetColumnID() const {return cColumn;}
+
+ virtual void Convert(XFCell * pCell, LwpTableLayout* pCellsMap=nullptr);
+protected:
+ virtual ~LwpCellList() override;
+
+ sal_uInt8 cColumn;
+ LwpObjectID cParent;
+
+ void Read() override;
+ LwpObjectID cValue;
+};
+/**
+ * @brief
+ * VO_ROWLIST object
+ */
+class LwpRowList final : public LwpDLVList
+{
+public:
+ LwpRowList(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ void Parse(IXFStream* pOutputStream) override;
+ LwpObjectID const & GetChildHeadID(){return cChild.GetHead();}
+ LwpObjectID const & GetNextID(){return GetNext();}
+ sal_uInt16 GetRowID() const {return cRowID;}
+private:
+ void Read() override;
+ virtual ~LwpRowList() override;
+
+ LwpDLVListHeadTail cChild;
+ LwpObjectID cParent;
+ sal_uInt16 cRowID;
+};
+/**
+ * @brief
+ * VO_NUMERICVALUE object
+ */
+class LwpNumericValue final : public LwpObject
+{
+public:
+ LwpNumericValue(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ double GetValue() const {return cNumber;}
+ void Parse(IXFStream* pOutputStream) override;
+private:
+ void Read() override;
+ virtual ~LwpNumericValue() override;
+
+ double cNumber;
+};
+
+/**
+ * @brief
+ * VO_TABLERANGE object
+ */
+class LwpTableRange final : public LwpDLVList
+{
+public:
+ LwpTableRange(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ void Parse(IXFStream* pOutputStream) override;
+ const LwpObjectID& GetCellRangeID() const {return cpCellRange;}
+ const LwpObjectID& GetTableID() const { return cqTable;}
+ LwpTableRange* GetNext() { return dynamic_cast<LwpTableRange*>(LwpDLVList::GetNext().obj().get());}
+private:
+ void Read() override;
+ virtual ~LwpTableRange() override;
+
+ LwpObjectID cqTable;
+ LwpObjectID cpCellRange;
+};
+/**
+ * @brief
+ * VO_CELLRANGE object
+ */
+class LwpCellRange final : public LwpObject
+{
+public:
+ LwpCellRange(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ void Parse(IXFStream* pOutputStream) override;
+ const LwpObjectID& GetFolderID() const {return cpFolder;}
+private:
+ void Read() override;
+ virtual ~LwpCellRange() override;
+
+ LwpObjectID cpFolder;
+};
+/**
+ * @brief
+ * VO_FOLDER object
+ */
+class LwpFolder final : public LwpDLVList
+{
+public:
+ LwpFolder(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ void Parse(IXFStream* pOutputStream) override;
+ LwpObjectID const & GetChildHeadID(){ return cChild.GetHead();}
+private:
+ void Read() override;
+ virtual ~LwpFolder() override;
+
+ LwpDLVListHeadTail cChild;
+ LwpObjectID cParent;
+ LwpObjectID cqTable;
+};
+/**
+ * @brief
+ * VO_DEPENDENT object
+ */
+class LwpDependent final : public LwpDLVList
+{
+public:
+ LwpDependent(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+
+ void Parse(IXFStream* pOutputStream) override;
+private:
+ void Read() override;
+ virtual ~LwpDependent() override;
+
+ LwpObjectID cFormulaInfo;
+ sal_uInt16 cReferenceOffset; // Used to fix dependent formula when we're
+ // dropped, sorted.
+ // Flags:
+ enum
+ {
+ START_CELL = 0x01,
+ END_CELL = 0x02,
+ REGISTERED = 0x04
+ };
+ sal_uInt8 cFlags; // Used to fix dependent formula when we're
+ // dropped, sorted.
+};
+
+/**
+ * @brief
+ * row or column id
+ */
+class LwpRowColumnQualifier
+{
+public:
+ LwpRowColumnQualifier();
+
+ bool IsAbsolute() const;
+
+ bool IsAfter() const;
+
+ bool IsBad() const;
+
+ void QuickRead(LwpObjectStream *pStrm);
+
+private:
+ enum // cFlags bit definitions
+ {
+ REF_ABSOLUTE = 0x01,
+ REF_AFTER = 0x02,
+ REF_BAD = 0x04
+ };
+ sal_uInt8 cFlags;
+};
+
+inline
+LwpRowColumnQualifier::LwpRowColumnQualifier() : cFlags(0)
+{
+}
+
+inline bool
+LwpRowColumnQualifier::IsAfter() const
+{
+ return (cFlags & REF_AFTER) != 0;
+}
+
+inline bool
+LwpRowColumnQualifier::IsBad() const
+{
+ return (cFlags & REF_BAD) != 0;
+}
+
+inline bool
+LwpRowColumnQualifier::IsAbsolute() const
+{
+ return (cFlags & REF_ABSOLUTE) != 0;
+}
+/**
+ * @brief
+ * row id
+ */
+class LwpRowSpecifier
+{
+public:
+ LwpRowSpecifier()
+ : cRow(0)
+ {}
+
+ void QuickRead(LwpObjectStream *pStrm);
+
+ sal_uInt16 RowID(sal_uInt16 FormulaRow);
+
+private:
+ sal_uInt16 cRow;
+ LwpRowColumnQualifier cQualifier;
+};
+
+inline sal_uInt16
+LwpRowSpecifier::RowID(sal_uInt16 FormulaRow)
+{
+ if (cQualifier.IsBad())
+ {
+ return 0xffff;
+ }
+ if (cQualifier.IsAbsolute())
+ return cRow;
+
+ if (cQualifier.IsAfter())
+ return FormulaRow + cRow;
+ return FormulaRow - cRow;
+}
+
+/**
+ * @brief
+ * column id
+ */
+class LwpColumnSpecifier
+{
+public:
+ LwpColumnSpecifier()
+ : cColumn(0)
+ {}
+
+ void QuickRead(LwpObjectStream *pStrm);
+
+ sal_uInt8 ColumnID(sal_uInt8 FormulaColumn);
+
+private:
+ sal_uInt8 cColumn;
+ LwpRowColumnQualifier cQualifier;
+};
+
+inline sal_uInt8
+LwpColumnSpecifier::ColumnID(sal_uInt8 FormulaColumn)
+{
+ if (cQualifier.IsBad())
+ {
+ return 0xff;
+ }
+ if (cQualifier.IsAbsolute())
+ return cColumn;
+ if (cQualifier.IsAfter())
+ return FormulaColumn + cColumn;
+ return FormulaColumn - cColumn;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
new file mode 100644
index 000000000..1a0b47822
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -0,0 +1,580 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table cell numerics format
+ */
+
+#include <lwpoverride.hxx>
+#include "lwptblcell.hxx"
+#include "lwppara.hxx"
+#include "lwptblformula.hxx"
+
+#include "lwptablelayout.hxx"
+#include <osl/thread.h>
+#include <rtl/ustrbuf.hxx>
+#include <sal/log.hxx>
+#include <memory>
+
+LwpFormulaArg::~LwpFormulaArg()
+{
+}
+
+ LwpFormulaInfo::LwpFormulaInfo(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpCellList(objHdr, pStrm)
+ , m_bSupported(true)
+ , m_nFormulaRow(0)
+{}
+
+LwpFormulaInfo::~LwpFormulaInfo()
+{
+}
+
+void LwpFormulaInfo::ReadConst()
+{
+ double Constant = m_pObjStrm->QuickReadDouble();
+
+ m_aStack.push_back( std::make_unique<LwpFormulaConst>(Constant) );
+}
+
+/**
+* Need more effort for unicode.
+*/
+void LwpFormulaInfo::ReadText()
+{
+ m_pObjStrm->QuickReadInt16(); //Disk Size
+ sal_uInt16 nStrLen = m_pObjStrm->QuickReadInt16();
+
+ std::vector<char> aBuf(nStrLen + 1);
+ m_pObjStrm->QuickRead(aBuf.data(), nStrLen);
+ aBuf[nStrLen]= '\0';
+ OUString aText = "\"" +
+ OUString(aBuf.data(), nStrLen, osl_getThreadTextEncoding()) +
+ "\"";
+
+ m_aStack.push_back(std::make_unique<LwpFormulaText>(aText));
+}
+
+void LwpFormulaInfo::ReadCellID()
+{
+ LwpRowSpecifier RowSpecifier;
+ LwpColumnSpecifier ColumnSpecifier;
+
+ RowSpecifier.QuickRead(m_pObjStrm.get());
+ ColumnSpecifier.QuickRead(m_pObjStrm.get());
+
+ m_aStack.push_back( std::make_unique<LwpFormulaCellAddr>(ColumnSpecifier.ColumnID(cColumn),
+ RowSpecifier.RowID(m_nFormulaRow)) );
+}
+
+void LwpFormulaInfo::ReadCellRange()
+{
+ ReadCellID( ); // start
+ std::unique_ptr<LwpFormulaCellAddr> pStartCellAddr( static_cast<LwpFormulaCellAddr*>(m_aStack.back().release()));
+ m_aStack.pop_back();
+
+ ReadCellID(); // end
+ std::unique_ptr<LwpFormulaCellAddr> pEndCellAddr(static_cast<LwpFormulaCellAddr*>(m_aStack.back().release()));
+ m_aStack.pop_back();
+
+ m_aStack.push_back( std::make_unique<LwpFormulaCellRangeAddr>(pStartCellAddr->GetCol(),
+ pStartCellAddr->GetRow(),
+ pEndCellAddr->GetCol(),
+ pEndCellAddr->GetRow()) );
+}
+
+/**
+* Read expression from wordpro file
+*/
+void LwpFormulaInfo::ReadExpression()
+{
+ sal_uInt16 TokenType, DiskLength;
+
+ /* Read the compiled expression length */
+ m_pObjStrm->SeekRel(2);
+
+ bool bError = false;
+ while ((TokenType = m_pObjStrm->QuickReaduInt16(&bError)) != TK_END)
+ {
+
+ if (bError)
+ throw std::runtime_error("error reading expression");
+
+ // Get the disk length of this token
+ DiskLength = m_pObjStrm->QuickReaduInt16();
+
+ switch (TokenType)
+ {
+ case TK_CONSTANT:
+ {
+ ReadConst();
+ break;
+ }
+
+ case TK_CELLID:
+ ReadCellID();
+ break;
+
+ case TK_CELLRANGE:
+ ReadCellRange();
+ break;
+
+ case TK_SUM:
+ case TK_IF:
+ case TK_COUNT:
+ case TK_MINIMUM:
+ case TK_MAXIMUM:
+ case TK_AVERAGE:
+ {
+ std::unique_ptr<LwpFormulaFunc> xFunc(new LwpFormulaFunc(TokenType));
+ ReadArguments(*xFunc);
+ m_aStack.push_back(std::move(xFunc));
+ }
+ break;
+
+ case TK_ADD://7
+ case TK_SUBTRACT:
+ case TK_MULTIPLY:
+ case TK_DIVIDE:
+ case TK_LESS:
+ case TK_LESS_OR_EQUAL:
+ case TK_GREATER:
+ case TK_GREATER_OR_EQUAL:
+ case TK_EQUAL:
+ case TK_NOT_EQUAL:
+ case TK_AND:
+ case TK_OR:
+ case TK_NOT:
+ m_pObjStrm->SeekRel(DiskLength); // extensible for future
+
+ if (m_aStack.size() >= 2)
+ {//binary operator
+ std::unique_ptr<LwpFormulaOp> pOp(new LwpFormulaOp(TokenType));
+ pOp->AddArg(std::move(m_aStack.back())); m_aStack.pop_back();
+ pOp->AddArg(std::move(m_aStack.back())); m_aStack.pop_back();
+ m_aStack.push_back(std::move(pOp));
+ }
+ break;
+ case TK_UNARY_MINUS:
+ if (!m_aStack.empty())
+ {
+ std::unique_ptr<LwpFormulaUnaryOp> pOp(new LwpFormulaUnaryOp(TokenType));
+ pOp->AddArg(std::move(m_aStack.back())); m_aStack.pop_back();
+ m_aStack.push_back(std::move(pOp));
+ }
+ break;
+ default:
+ // We don't know what to do with this token, so eat it.
+ m_pObjStrm->SeekRel(DiskLength);
+ break;
+ }
+ MarkUnsupported(TokenType);
+ }
+}
+
+void LwpFormulaInfo::MarkUnsupported(sal_uInt16 TokenType)
+{
+ switch(TokenType)
+ {
+ case TK_IF:
+ case TK_COUNT:
+ case TK_NOT:
+ {
+ m_bSupported = false;//Not supported formulas
+ }
+ break;
+ default:
+ break;
+ }
+}
+/**
+* Read arguments of functions from wordpro file
+* @param LwpFormulaFunc& aFunc, functions object
+*/
+void LwpFormulaInfo::ReadArguments(LwpFormulaFunc& aFunc)
+{
+ sal_uInt16 NumberOfArguments = m_pObjStrm->QuickReaduInt16();
+
+ for (sal_uInt16 Count = 0; Count < NumberOfArguments; Count++)
+ {
+ sal_uInt8 ArgumentType = static_cast<sal_uInt8>(m_pObjStrm->QuickReaduInt16()); // written as lushort
+ sal_uInt16 ArgumentDiskLength = m_pObjStrm->QuickReaduInt16();
+ bool bArgument = true;
+
+ switch(ArgumentType)
+ {
+ case TK_CELLID:
+ ReadCellID();
+ break;
+
+ case TK_CELLRANGE:
+ ReadCellRange();
+ break;
+
+ case TK_CONSTANT:
+ ReadConst();
+ break;
+
+ case TK_TEXT:
+ ReadText();
+ break;
+
+ case TK_EXPRESSION:
+ ReadExpression();
+ break;
+
+ default:
+ bArgument = false;
+ m_pObjStrm->SeekRel(ArgumentDiskLength);
+ break;
+ }
+
+ if (bArgument && !m_aStack.empty())
+ {
+ aFunc.AddArg(std::move(m_aStack.back()));
+ m_aStack.pop_back();
+ }
+ }
+}
+
+void LwpFormulaInfo::Read()
+{
+ LwpCellList::Read();
+ {
+ LwpRowList* pRowList = dynamic_cast<LwpRowList*>(cParent.obj().get());
+ if (pRowList)
+ {
+ m_nFormulaRow = pRowList->GetRowID();
+ }
+ else
+ {
+ SAL_WARN("lwp", "missing row list");
+ }
+ }
+ m_pObjStrm->SeekRel(2);//flags, size in file: sal_uInt16
+
+ LwpNotifyListPersistent cNotifyList;
+ cNotifyList.Read(m_pObjStrm.get());
+
+ ReadExpression();
+
+ m_pObjStrm->SkipExtra();
+}
+
+/**
+* Make the formula string.
+*/
+OUString LwpFormulaInfo::Convert(LwpTableLayout* pCellsMap)
+{
+ OUString aFormula;
+ if (m_bSupported)
+ {
+ if(1==m_aStack.size())
+ {
+ aFormula = m_aStack[0]->ToString(pCellsMap);
+ }
+ else
+ {
+ assert(false);
+ }
+ }
+ return aFormula;
+}
+
+/**
+* Fill the XFCell content
+*/
+void LwpFormulaInfo::Convert(XFCell * pCell,LwpTableLayout* pCellsMap)
+{
+ OUString aFormula = Convert(pCellsMap);
+ if (!aFormula.isEmpty())
+ {
+ pCell->SetFormula(aFormula);
+ }
+ LwpCellList::Convert(pCell);
+}
+
+LwpFormulaConst::LwpFormulaConst(double dVal)
+{
+ m_dVal = dVal;
+}
+
+OUString LwpFormulaConst::ToString(LwpTableLayout* /*pCellsMap*/)
+{
+ return OUString::number(m_dVal);
+}
+
+LwpFormulaText::LwpFormulaText( const OUString& aText) : m_aText(aText)
+{
+}
+
+LwpFormulaCellAddr::LwpFormulaCellAddr(sal_Int16 aCol, sal_Int16 aRow)
+ : m_aCol(aCol), m_aRow(aRow)
+{
+}
+
+OUString LwpFormulaCellAddr::ToString(LwpTableLayout* pCellsMap)
+{
+ OUString aCellAddr = "<" + LwpFormulaTools::GetCellAddr(m_aRow,m_aCol,pCellsMap) + ">";
+ return aCellAddr;
+}
+
+LwpFormulaCellRangeAddr::LwpFormulaCellRangeAddr(sal_Int16 aStartCol,
+ sal_Int16 aStartRow,
+ sal_Int16 aEndCol,
+ sal_Int16 aEndRow)
+ : m_aStartCol(aStartCol), m_aStartRow(aStartRow),
+ m_aEndCol(aEndCol), m_aEndRow(aEndRow)
+{
+}
+
+/**
+* Convert the cell range into a string
+*/
+OUString LwpFormulaCellRangeAddr::ToString(LwpTableLayout* pCellsMap)
+{
+ OUString aCellAddr = "<"
+ + LwpFormulaTools::GetCellAddr(m_aStartRow,m_aStartCol,pCellsMap) + ":"
+ + LwpFormulaTools::GetCellAddr(m_aEndRow,m_aEndCol,pCellsMap) + ">";
+
+ return aCellAddr;
+}
+
+LwpFormulaFunc::LwpFormulaFunc(sal_uInt16 nTokenType) : m_nTokenType(nTokenType)
+{
+}
+
+LwpFormulaFunc::~LwpFormulaFunc()
+{
+}
+void LwpFormulaFunc::AddArg(std::unique_ptr<LwpFormulaArg> pArg)
+{
+ m_aArgs.push_back(std::move(pArg));
+}
+/**
+* Convert the functions to a string, which is an argument of other formula
+*/
+OUString LwpFormulaFunc::ToArgString(LwpTableLayout* pCellsMap)
+{
+ OUStringBuffer aFormula;
+ aFormula.append('(');
+ aFormula.append(ToString(pCellsMap));
+ aFormula.append(')');
+ return aFormula.makeStringAndClear();
+}
+/**
+* Convert the function to a formula string.
+*/
+OUString LwpFormulaFunc::ToString(LwpTableLayout* pCellsMap)
+{
+ OUStringBuffer aFormula;
+
+ OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType);
+ aFormula.append(aFuncName);
+ aFormula.append(" ");//Append a blank space
+
+ //Append args
+ for (auto const& elem : m_aArgs)
+ {
+ aFormula.append(elem->ToArgString(pCellsMap)).append("|"); //separator
+ }
+
+ //erase the last "|"
+ if (!m_aArgs.empty())
+ {
+ aFormula.setLength(aFormula.getLength()-1);
+ }
+ else
+ {
+ assert(false);
+ }
+
+ return aFormula.makeStringAndClear();
+}
+
+/**
+* Convert the formula in operators to a string : e.g. 1+2+3
+*/
+OUString LwpFormulaOp::ToString(LwpTableLayout* pCellsMap)
+{
+ OUString aFormula;
+ if (2==m_aArgs.size())
+ {
+ aFormula += m_aArgs[1]->ToArgString(pCellsMap) + " ";
+ OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType);
+
+ aFormula += aFuncName + " " +
+ m_aArgs[0]->ToArgString(pCellsMap);
+ }
+ else
+ {
+ assert(false);
+ }
+ return aFormula;
+}
+
+/**
+* convert the formula in unary operators into string : e.g. -2
+*/
+OUString LwpFormulaUnaryOp::ToString(LwpTableLayout* pCellsMap)
+{
+ OUString aFormula;
+ if (1==m_aArgs.size())
+ {
+ OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType);
+ aFormula += aFuncName +
+ m_aArgs[0]->ToArgString(pCellsMap);
+ }
+ else
+ {
+ assert(false);
+ }
+ return aFormula;
+}
+/**
+* Get token name
+*/
+OUString LwpFormulaTools::GetName(sal_uInt16 nTokenType)
+{
+ OUString aName;
+ switch(nTokenType)
+ {
+ case TK_SUM:
+ aName = "SUM";
+ break;
+ case TK_IF:
+ aName = "IF";//Not supported by SODC
+ break;
+ case TK_COUNT:
+ aName = "COUNT";//Not supported by SODC
+ break;
+ case TK_MINIMUM:
+ aName = "MIN";
+ break;
+ case TK_MAXIMUM:
+ aName = "MAX";
+ break;
+ case TK_AVERAGE:
+ aName = "MEAN";
+ break;
+ case TK_ADD:
+ aName = "+";
+ break;
+ case TK_SUBTRACT:
+ aName = "-";
+ break;
+ case TK_MULTIPLY:
+ aName = "*";
+ break;
+ case TK_DIVIDE:
+ aName = "/";
+ break;
+ case TK_UNARY_MINUS:
+ aName = "-";
+ break;
+ case TK_LESS:
+ aName = "L";
+ break;
+ case TK_LESS_OR_EQUAL:
+ aName = "LEQ";
+ break;
+ case TK_GREATER:
+ aName = "G";
+ break;
+ case TK_GREATER_OR_EQUAL:
+ aName = "GEQ";
+ break;
+ case TK_EQUAL:
+ aName = "EQ";
+ break;
+ case TK_NOT_EQUAL:
+ aName = "NEQ";
+ break;
+ case TK_NOT:
+ aName = "NOT";
+ break;
+ case TK_AND:
+ aName = "AND";
+ break;
+ case TK_OR:
+ aName = "OR";
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ return aName;
+}
+
+/**
+* Get cell address in String
+*/
+OUString LwpFormulaTools::GetCellAddr(sal_Int16 nRow, sal_Int16 nCol, LwpTableLayout* pCellsMap)
+{
+ OUString aCellAddr;
+ XFCell* pCell = pCellsMap->GetCellsMap(nRow,static_cast<sal_uInt8>(nCol));
+ if (pCell)
+ {
+ aCellAddr = pCell->GetCellName();
+ }
+ else
+ {
+ assert( -1==nRow || -1==static_cast<sal_Int8>(nCol));
+ }
+ return aCellAddr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptblformula.hxx b/lotuswordpro/source/filter/lwptblformula.hxx
new file mode 100644
index 000000000..ee90e1944
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptblformula.hxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - table object
+ */
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTBLFORMULA_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTBLFORMULA_HXX
+
+#include <rtl/ustring.hxx>
+#include <memory>
+#include <vector>
+#include "lwptblcell.hxx"
+
+/* These token types are written to the file. Don't change their
+values unless you filter them.
+*/
+enum lTokenType
+{
+ TK_BAD = 0,
+ TK_OPERAND = 1,
+ TK_END = 2,
+ TK_RIGHTPAREN = 3,
+ TK_FUNCTION = 4,
+ TK_LEFTPAREN = 5,
+ TK_UNARY_MINUS = 6,
+ TK_ADD = 7,
+ TK_SUBTRACT = 8,
+ TK_MULTIPLY = 9,
+ TK_DIVIDE = 10,
+ TK_EQUAL = 11,
+ TK_LESS = 12,
+ TK_GREATER = 13,
+ TK_NOT_EQUAL = 14,
+ TK_GREATER_OR_EQUAL = 15,
+ TK_LESS_OR_EQUAL = 16,
+ TK_NOT = 17,
+ TK_AND = 18,
+ TK_OR = 19,
+ TK_CELLID = 20,
+ TK_CONSTANT = 21,
+ TK_TEXT = 22,
+ TK_SUM = 23,
+ TK_IF = 24,
+ TK_AVERAGE = 25,
+ TK_MAXIMUM = 26,
+ TK_MINIMUM = 27,
+ TK_COUNT = 28,
+ TK_CELLRANGE = 29,
+ TK_EXPRESSION = 30,
+ TK_OPEN_FUNCTION = 31,
+ TK_LIST_SEPARATOR = 32
+};
+class LwpTableLayout;
+class LwpFormulaArg
+{
+public:
+ virtual ~LwpFormulaArg() = 0;
+ virtual OUString ToString(LwpTableLayout* pCellsMap)=0;
+ virtual OUString ToArgString(LwpTableLayout* pCellsMap){ return ToString(pCellsMap);}
+};
+
+class LwpFormulaTools
+{
+public:
+ static OUString GetName(sal_uInt16 nTokenType);
+ static OUString GetCellAddr(sal_Int16 nRow, sal_Int16 nCol, LwpTableLayout* pCellsMap);
+};
+
+class LwpFormulaConst:public LwpFormulaArg
+{
+public:
+ explicit LwpFormulaConst( double dVal);
+ virtual OUString ToString(LwpTableLayout* pCellsMap) override;
+private:
+ double m_dVal;
+};
+
+class LwpFormulaText:public LwpFormulaArg
+{
+public:
+ explicit LwpFormulaText( const OUString& aText);
+ virtual OUString ToString(LwpTableLayout* /*pCellsMap*/) override {return m_aText;}
+private:
+ OUString m_aText;
+};
+
+class LwpFormulaCellAddr:public LwpFormulaArg
+{
+public:
+ LwpFormulaCellAddr(sal_Int16 aCol, sal_Int16 aRow);
+
+ sal_Int16 GetCol() const {return m_aCol;}
+ sal_Int16 GetRow() const {return m_aRow;}
+
+ virtual OUString ToString(LwpTableLayout* pCellsMap) override;
+private:
+ sal_Int16 m_aCol;
+ sal_Int16 m_aRow;
+};
+
+class LwpFormulaCellRangeAddr:public LwpFormulaArg
+{
+public:
+ LwpFormulaCellRangeAddr(sal_Int16 aStartCol, sal_Int16 aStartRow, sal_Int16 aEndCol, sal_Int16 aEndRow);
+
+ virtual OUString ToString(LwpTableLayout* pCellsMap) override;
+private:
+ sal_Int16 m_aStartCol;
+ sal_Int16 m_aStartRow;
+ sal_Int16 m_aEndCol;
+ sal_Int16 m_aEndRow;
+};
+
+class LwpFormulaFunc :public LwpFormulaArg
+{
+public:
+ explicit LwpFormulaFunc(sal_uInt16 nTokenType);
+ virtual ~LwpFormulaFunc() override;
+
+ void AddArg(std::unique_ptr<LwpFormulaArg> pArg);
+
+ virtual OUString ToString(LwpTableLayout* pCellsMap) override;
+ OUString ToArgString(LwpTableLayout* pCellsMap) override;
+
+protected:
+ std::vector<std::unique_ptr<LwpFormulaArg>> m_aArgs;
+ sal_uInt16 m_nTokenType;
+};
+
+class LwpFormulaOp : public LwpFormulaFunc
+{
+public:
+ explicit LwpFormulaOp(sal_uInt16 nTokenType):LwpFormulaFunc(nTokenType){}
+ virtual OUString ToString(LwpTableLayout* pCellsMap) override;
+};
+
+class LwpFormulaUnaryOp : public LwpFormulaFunc
+{
+public:
+ explicit LwpFormulaUnaryOp(sal_uInt16 nTokenType):LwpFormulaFunc(nTokenType){}
+ virtual OUString ToString(LwpTableLayout* pCellsMap) override;
+};
+
+class LwpFormulaInfo final : public LwpCellList
+{
+public:
+ LwpFormulaInfo(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ OUString Convert(LwpTableLayout* pCellsMap);
+ void Convert(XFCell * pCell, LwpTableLayout* pCellsMap=nullptr) override;
+private:
+ void Read() override;
+ void ReadCellID();
+ void ReadText();
+ void ReadCellRange();
+ void ReadExpression();
+ void ReadArguments(LwpFormulaFunc& aFunc);
+ bool m_bSupported;
+ virtual ~LwpFormulaInfo() override;
+ void ReadConst();
+ void MarkUnsupported(sal_uInt16 TokenType);
+
+ std::vector<std::unique_ptr<LwpFormulaArg>> m_aStack;
+ sal_uInt16 m_nFormulaRow;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx
new file mode 100644
index 000000000..8888e6af9
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptoc.cxx
@@ -0,0 +1,475 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/**
+ * @file
+ * For LWP filter architecture prototype - TOC related object
+ */
+
+#include "lwptoc.hxx"
+#include <lwpfoundry.hxx>
+#include "lwpdoc.hxx"
+#include "lwpframelayout.hxx"
+#include <lwpglobalmgr.hxx>
+
+#include <xfilter/xffont.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xfindex.hxx>
+#include <xfilter/xffloatframe.hxx>
+#include <xfilter/xfframestyle.hxx>
+#include <xfilter/xfframe.hxx>
+#include <xfilter/xftable.hxx>
+
+LwpTocSuperLayout::LwpTocSuperLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpSuperTableLayout(objHdr, pStrm)
+ , m_nFrom(0)
+ , m_pCont(nullptr)
+{
+}
+
+LwpTocSuperLayout::~LwpTocSuperLayout()
+{
+}
+
+/**
+ * @short Read TOCSUPERTABLELAYOUT object
+ * @return none
+ */
+void LwpTocSuperLayout::Read()
+{
+ LwpSuperTableLayout::Read();
+ m_TextMarker.Read(m_pObjStrm.get());
+ m_ParentName.Read(m_pObjStrm.get());
+ m_DivisionName.Read(m_pObjStrm.get());
+ m_SectionName.Read(m_pObjStrm.get());
+ m_nFrom = m_pObjStrm->QuickReaduInt16();
+
+ m_SearchItems.Read(m_pObjStrm.get());
+
+ sal_uInt16 count = m_pObjStrm->QuickReaduInt16();
+ if (count > MAX_LEVELS)
+ throw std::range_error("corrupt LwpTocSuperLayout");
+ for (sal_uInt16 i = 0; i < count; ++i)
+ m_DestName[i].Read(m_pObjStrm.get());
+
+ count = m_pObjStrm->QuickReaduInt16();
+ if (count > MAX_LEVELS)
+ throw std::range_error("corrupt LwpTocSuperLayout");
+ for (sal_uInt16 i = 0; i < count; ++i)
+ m_DestPGName[i].Read(m_pObjStrm.get());
+
+ count = m_pObjStrm->QuickReaduInt16();
+ if (count > MAX_LEVELS)
+ throw std::range_error("corrupt LwpTocSuperLayout");
+ for (sal_uInt16 i = 0; i < count; ++i)
+ m_nFlags[i] = m_pObjStrm->QuickReaduInt32();
+
+ m_pObjStrm->SkipExtra();
+}
+/**
+ * @short Register style of TOC
+ * @return none
+ */
+void LwpTocSuperLayout::RegisterStyle()
+{
+ LwpSuperTableLayout::RegisterStyle();
+
+ // Get font info of default text style and set into tab style
+ const LwpObjectID *pDefaultTextStyle = m_pFoundry ? m_pFoundry->GetDefaultTextStyle() : nullptr;
+ XFParaStyle* pBaseStyle = pDefaultTextStyle ? dynamic_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*pDefaultTextStyle)) : nullptr;
+ std::unique_ptr<XFTextStyle> pTextStyle(new XFTextStyle);
+ if (pBaseStyle)
+ pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font?????
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_TabStyleName = pXFStyleManager->AddStyle(std::move(pTextStyle)).m_pStyle->GetStyleName();
+
+}
+/**
+ * @short Convert TOC
+ * @param pCont - container
+ * @return none
+ */
+void LwpTocSuperLayout::XFConvert(XFContentContainer* pCont)
+{
+ rtl::Reference<XFIndex> xToc(new XFIndex);
+
+ xToc->SetProtected(false);
+ xToc->SetIndexType(enumXFIndexTOC);
+
+ // add TOC template
+ for (sal_uInt16 i = 1; i<= MAX_LEVELS; i++)
+ {
+ LwpTocLevelData * pLevel = GetSearchLevelPtr(i);
+ XFIndexTemplate * pTemplate = new XFIndexTemplate();
+
+ if(!pLevel)
+ {
+ // add a blank template so that SODC won't add default style to this level
+ xToc->AddTemplate(OUString::number(i), OUString(), pTemplate);
+ continue;
+ }
+
+ bool bInserted = false;
+ do
+ {
+ // One level has 1 template
+ if (!bInserted)
+ {
+ pTemplate->SetLevel(OUString::number(i));
+ if(pLevel->GetUseLeadingText())
+ {
+ pTemplate->AddEntry(enumXFIndexTemplateChapter, pLevel->GetSearchStyle());
+ }
+ if(pLevel->GetUseText())
+ {
+ pTemplate->AddEntry(enumXFIndexTemplateText, pLevel->GetSearchStyle());
+ }
+ if(GetUsePageNumber(i))
+ {
+ sal_uInt16 nLeaderType = GetSeparatorType(i);
+ if (GetRightAlignPageNumber(i))
+ {
+ char cSep = ' ';
+ switch(nLeaderType)
+ {
+ default: // go through
+ case NONE: // no leaders
+ cSep = ' ';
+ break;
+ case LEADERDOTS:
+ cSep = '.';
+ break;
+ case LEADERDASHES:
+ cSep = '-';
+ break;
+ case LEADERUNDERLINE:
+ cSep = '_';
+ break;
+ }
+
+ pTemplate->AddTabEntry(enumXFTabRight, 0, cSep, 'd', m_TabStyleName);
+ }
+ else
+ {
+ OUString sSep;
+ switch(nLeaderType)
+ {
+ default: // go through
+ case NONE: // no leaders
+ sSep = " ";
+ break;
+ case SEPARATORCOMMA:
+ sSep = ", ";
+ break;
+ case SEPARATORDOTS:
+ sSep = "...";
+ break;
+ }
+ pTemplate->AddTextEntry(sSep, m_TabStyleName);
+ }
+ //"TOC Page Number Text Style" style always exists in Word Pro file
+ pTemplate->AddEntry(enumXFIndexTemplatePage, "TOC Page Number Text Style");
+ }
+
+ xToc->AddTemplate(OUString::number(static_cast<sal_Int32>(i)), m_pFoundry->FindActuralStyleName(pLevel->GetSearchStyle()), pTemplate);
+ bInserted = true;
+ }
+
+ // 1 style in WordPro may be mapped to several styles in SODC
+ LwpDocument * pDocument = m_pFoundry->GetDocument()->GetRootDocument();
+ AddSourceStyle(xToc.get(), pLevel, pDocument->GetFoundry());
+
+ // one level may have several corresponding Styles
+ pLevel = GetNextSearchLevelPtr(i, pLevel); // find next LwpTocLevelData which is same index
+ }while (pLevel != nullptr);
+ }
+
+ m_pCont = pCont;
+ // add TOC content
+ LwpSuperTableLayout::XFConvert(xToc.get());
+
+ rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout());
+ if (!xContainer.is())
+ return;
+
+ // if current TOC is located in a cell, we must add a frame between upper level container and TOC
+ if (!xContainer->IsCell())
+ {
+ pCont->Add(xToc.get());
+ }
+}
+
+/**
+ * @short convert frame which anchor to page
+ * @param pCont -
+ * @return
+ */
+void LwpTocSuperLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart, sal_Int32 nEnd, bool bAll)
+{
+ if (!m_pFrame)
+ return;
+
+ rtl::Reference<XFFrame> xXFFrame;
+ if(nEnd < nStart)
+ {
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
+
+ m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart));
+
+ //parse table, and add table to frame or TOC
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (!pTableLayout)
+ return;
+
+ XFContentContainer* pTableContainer = xXFFrame.get();
+ // if *this is a TOCSuperTableLayout and it's located in a cell
+ // add the frame to upper level and add TOCSuperTableLayout into the frame
+ rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout());
+ if (!xContainer.is())
+ return;
+ if (xContainer->IsCell())
+ {
+ pTableContainer = pCont; // TOC contain table directly
+ xXFFrame->Add(pCont);
+ m_pCont->Add(xXFFrame.get());
+ }
+ else
+ {
+ //add frame to the container
+ pCont->Add(xXFFrame.get());
+ }
+ pTableLayout->XFConvert(pTableContainer);
+
+}
+
+/**
+ * @short Add source style into TOC
+ * @param pToc - TOC pointer
+ * @param pLevel - TOC level data
+ * @param pFoundry - foundry pointer
+ * @return sal_Bool
+ */
+void LwpTocSuperLayout::AddSourceStyle(XFIndex* pToc, LwpTocLevelData * pLevel, LwpFoundry * pFoundry)
+{
+ if (!pLevel)
+ {
+ return;
+ }
+
+ OUString sLwpStyleName = pLevel->GetSearchStyle();
+
+ if (!pFoundry)
+ return;
+
+ LwpDocument * pDoc = pFoundry->GetDocument();
+ if (pDoc && pDoc->IsChildDoc())
+ {
+ OUString sSodcStyleName = pFoundry->FindActuralStyleName(sLwpStyleName);
+ pToc->AddTocSource(pLevel->GetLevel(), sSodcStyleName);
+ }
+ else
+ {
+ pDoc = pDoc->GetFirstDivision();
+ while (pDoc)
+ {
+ AddSourceStyle(pToc, pLevel, pDoc->GetFoundry() );
+ pDoc = pDoc->GetNextDivision();
+ }
+ }
+}
+
+/**
+ * @short Get whether page number is right alignment
+ * @param index - TOC level
+ * @return sal_Bool
+ */
+bool LwpTocSuperLayout::GetRightAlignPageNumber(sal_uInt16 index)
+{
+ if (index < MAX_LEVELS)
+ return (m_nFlags[index] & TS_RIGHTALIGN) != 0;
+ return false;
+}
+/**
+ * @short Get whether page number is used in TOC entries
+ * @param index - TOC level
+ * @return sal_Bool
+ */
+bool LwpTocSuperLayout::GetUsePageNumber(sal_uInt16 index)
+{
+ if (index < MAX_LEVELS)
+ return (m_nFlags[index] & TS_PAGENUMBER) != 0;
+ return false;
+}
+/**
+ * @short Get what is used for separator
+ * @param index - TOC level
+ * @return sal_uInt16 - separator type
+ */
+sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index)
+{
+ if (index >= MAX_LEVELS)
+ return NONE;
+
+ sal_uInt16 Flag = static_cast<sal_uInt16>(m_nFlags[index]);
+
+ if (Flag & TS_LEADERDOTS)
+ return LEADERDOTS;
+ else if (Flag & TS_LEADERDASHES)
+ return LEADERDASHES;
+ else if (Flag & TS_LEADERUNDERLINE)
+ return LEADERUNDERLINE;
+ else if (Flag & TS_SEPARATORCOMMA)
+ return SEPARATORCOMMA;
+ else if (Flag & TS_SEPARATORDOTS)
+ return SEPARATORDOTS;
+ else
+ return NONE;
+}
+
+/**
+ * @short Get TOCLEVELDATA obj
+ * @param index - TOC level
+ * @return LwpTocLevelData * - pointer to TOCLEVELDATA obj
+ */
+LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
+{
+ LwpObjectID * pID = &m_SearchItems.GetHead(); // not necessary to check pID NULL or not
+ LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
+
+ while(pObj)
+ {
+ if(pObj->GetLevel()== index)
+ {
+ return pObj;
+ }
+
+ pID = &pObj->GetNext(); // not necessary to check pID NULL or not
+ pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
+ }
+
+ return nullptr;
+}
+/**
+ * @short Get next TOCLEVELDATA obj from current position
+ * @param index - TOC level
+ * @param pCurData - current LwpTocLevelData
+ * @return LwpTocLevelData * - pointer to TOCLEVELDATA obj
+ */
+LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData)
+{
+ LwpObjectID * pID = &pCurData->GetNext();
+ LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
+
+ while(pObj)
+ {
+ if(pObj->GetLevel()== index)
+ {
+ return pObj;
+ }
+
+ pID = &pObj->GetNext(); // not necessary to check pID NULL or not
+ pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
+ }
+
+ return nullptr;
+}
+
+LwpTocLevelData::LwpTocLevelData(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpDLVList(objHdr, pStrm), m_nFlags(0), m_nLevel(0)
+{
+}
+LwpTocLevelData::~LwpTocLevelData()
+{
+}
+/**
+ * @short Register style
+ * @param
+ * @return
+ */
+void LwpTocLevelData::RegisterStyle()
+{
+}
+/**
+ * @short Convert
+ * @param pCont - container
+ * @return none
+ */
+void LwpTocLevelData::XFConvert(XFContentContainer* /*pCont*/)
+{
+}
+/**
+ * @short Read TOCLEVELDATA obj
+ * @param
+ * @return
+ */
+void LwpTocLevelData::Read()
+{
+ LwpDLVList::Read();
+ m_nFlags = m_pObjStrm->QuickReaduInt16();
+ m_nLevel = m_pObjStrm->QuickReaduInt16();
+ m_SearchName.Read(m_pObjStrm.get());
+
+ m_pObjStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptoc.hxx b/lotuswordpro/source/filter/lwptoc.hxx
new file mode 100644
index 000000000..8516124c8
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptoc.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTOC_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTOC_HXX
+
+#include "lwptablelayout.hxx"
+
+class XFIndex;
+class LwpFoundry;
+class LwpTocLevelData;
+class XFIndex;
+/**
+ * @brief
+ * VO_TOCSUPERTABLELAYOUT object
+ */
+class LwpTocSuperLayout final : public LwpSuperTableLayout
+{
+public:
+ LwpTocSuperLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ virtual ~LwpTocSuperLayout() override;
+ void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_TOC_SUPERTABLE_LAYOUT;}
+ virtual void XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart = 0, sal_Int32 nEnd = 0, bool bAll = false) override;
+private:
+ void Read() override;
+ bool GetRightAlignPageNumber(sal_uInt16 index);
+ bool GetUsePageNumber(sal_uInt16 index);
+ sal_uInt16 GetSeparatorType(sal_uInt16 index);
+ LwpTocLevelData * GetSearchLevelPtr(sal_uInt16 index);
+ static LwpTocLevelData * GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData);
+ void AddSourceStyle(XFIndex* pToc, LwpTocLevelData * pLevel, LwpFoundry * pFoundry);
+
+ enum {MAX_LEVELS = 9};
+ enum
+ {
+ TS_NOLEADERS = 0x01,
+ TS_LEADERDOTS = 0x02,
+ TS_LEADERDASHES = 0x04,
+ TS_LEADERUNDERLINE = 0x08,
+ TS_SEPARATORCOMMA = 0x10,
+ TS_SEPARATORDOTS = 0x20,
+ TS_PAGENUMBER = 0x40,
+ TS_RIGHTALIGN = 0x80
+ };
+
+ enum
+ {
+ NONE = 0,
+ LEADERDOTS = 1,
+ LEADERDASHES = 2,
+ LEADERUNDERLINE = 3,
+ SEPARATORCOMMA = 4,
+ SEPARATORDOTS = 5
+ };
+
+ //m_nFrom
+ enum
+ {
+ SELECTEDTEXT = 1,
+ ENTIREDOCUMENT = 2,
+ CURRENTLEVELDIVISION = 3,
+ CURRENTDIVISION = 4,
+ CURRENTSECTION = 5
+ };
+
+ LwpAtomHolder m_TextMarker; /* for selected text */
+ LwpAtomHolder m_ParentName; /* for currentleveldivision */
+ LwpAtomHolder m_DivisionName; /* for currentdivision&currentsection */
+ LwpAtomHolder m_SectionName; /* for currentsection */
+ sal_uInt16 m_nFrom;
+ LwpDLVListHeadTail m_SearchItems;
+ LwpAtomHolder m_DestName[MAX_LEVELS];
+ LwpAtomHolder m_DestPGName[MAX_LEVELS];
+ sal_uInt32 m_nFlags[MAX_LEVELS];
+
+ OUString m_TabStyleName;
+
+ XFContentContainer* m_pCont;
+};
+/**
+ * @brief
+ * VO_TOCLEVELDATA object
+ */
+class LwpTocLevelData : public LwpDLVList
+{
+public:
+ enum
+ {
+ USETEXT = 0x01,
+ USENUMBER = 0x02
+ };
+ LwpTocLevelData(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
+ void RegisterStyle() override;
+ virtual void XFConvert(XFContentContainer* pCont) override;
+ sal_uInt16 GetLevel() const {return m_nLevel;}
+ bool GetUseText() const { return (m_nFlags & USETEXT) != 0;}
+ OUString const & GetSearchStyle() const {return m_SearchName.str();}
+ bool GetUseLeadingText() const { return (m_nFlags & USENUMBER) != 0;}
+private:
+ virtual ~LwpTocLevelData() override;
+
+ sal_uInt16 m_nFlags;
+ sal_uInt16 m_nLevel;
+ LwpAtomHolder m_SearchName;
+
+protected:
+ void Read() override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptools.cxx b/lotuswordpro/source/filter/lwptools.cxx
new file mode 100644
index 000000000..6c84aaab5
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptools.cxx
@@ -0,0 +1,849 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <lwptools.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <osl/process.h>
+#include <osl/thread.h>
+#include <osl/file.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+#include <unicode/datefmt.h>
+#include <unicode/udat.h>
+#include <i18nlangtag/languagetagicu.hxx>
+
+#ifdef SAL_UNX
+#define SEPARATOR '/'
+#else
+#define SEPARATOR '\\'
+#endif
+
+using namespace ::osl;
+
+/**
+ * @descr read lwp unicode string from stream to OUString per aEncoding
+*/
+void LwpTools::QuickReadUnicode(LwpObjectStream* pObjStrm,
+ OUString& str, sal_uInt16 strlen, rtl_TextEncoding aEncoding)
+ //strlen: length of bytes
+{
+ OUStringBuffer strBuf(128);
+
+ if( !IsUnicodePacked(pObjStrm, strlen) )
+ {
+ sal_uInt16 len = 0;
+ char buf[1024];
+
+ while(strlen)
+ {
+ len = std::min(sal_uInt16(1023), strlen);
+ len = pObjStrm->QuickRead(buf, len);
+ buf[len] = '\0';
+ strBuf.append( OUString(buf, len, aEncoding) );
+ strlen -= len;
+ if(!len) break;
+ }
+ str = strBuf.makeStringAndClear();
+ }
+ else
+ {
+ char buf[1024];
+ sal_Unicode unibuf[1024];
+ sal_uInt8 readbyte;
+ sal_uInt16 readword;
+
+ bool flag = false; //switch if unicode part reached
+ sal_uInt16 sublen = 0;
+
+ sal_uInt16 readLen = 0;
+ while(readLen<strlen)
+ {
+ if(!flag) //Not unicode string
+ {
+ bool bFailure;
+ readbyte = pObjStrm->QuickReaduInt8(&bFailure);
+ if(bFailure) break;
+ readLen+=sizeof(readbyte);
+
+ if(readbyte == 0x00)
+ {
+ flag = true;
+ if(sublen>0) //add it to the strBuf
+ {
+ strBuf.append( OUString(buf, sublen, aEncoding) ); //try the aEncoding
+ sublen = 0;
+ }
+ }
+ else
+ {
+ buf[sublen++] = readbyte;
+ }
+ if(sublen>=1023 || readLen==strlen) //add it to the strBuf
+ {
+ strBuf.append( OUString(buf, sublen, aEncoding) ); //try the aEncoding
+ sublen = 0;
+ }
+ }
+ else //unicode string
+ {
+ bool bFailure;
+ readword = pObjStrm->QuickReaduInt16(&bFailure);
+ if(bFailure) break;
+ readLen+=sizeof(readword);
+
+ if(readword == 0x0000)
+ {
+ flag = false;
+ if(sublen)
+ {
+ unibuf[sublen] = '\0';
+ strBuf.append( OUString(unibuf) );
+ sublen = 0;
+ }
+ }
+ else
+ {
+ unibuf[sublen++] = readword;
+ }
+ if(sublen>=1023 || readLen==strlen)
+ {
+ unibuf[sublen] = '\0';
+ strBuf.append( OUString(unibuf) );
+ sublen = 0;
+ }
+ }
+ }
+ str = strBuf.makeStringAndClear();
+ }
+}
+
+/**
+ * @descr Judge if the data (len) in object stream is lwp unicode packed
+*/
+bool LwpTools::IsUnicodePacked(LwpObjectStream* pObjStrm, sal_uInt16 len)
+{
+ sal_uInt8 byte;
+ sal_uInt16 oldpos = pObjStrm->GetPos();
+
+ for (sal_uInt16 i = 0; i < len; i++)
+ {
+ byte = pObjStrm->QuickReaduInt8();
+ if (byte == 0x00)
+ {
+ pObjStrm->Seek(oldpos);
+ return true;
+ }
+ }
+ pObjStrm->Seek(oldpos);
+ return false;
+}
+
+bool LwpTools::isFileUrl(const OString &fileName)
+{
+ return fileName.startsWith("file://");
+}
+
+OUString LwpTools::convertToFileUrl(const OString &fileName)
+{
+ if ( isFileUrl(fileName) )
+ {
+ return OStringToOUString(fileName, osl_getThreadTextEncoding());
+ }
+
+ OUString uUrlFileName;
+ OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding());
+ if ( fileName.startsWith(".") || fileName.indexOf(SEPARATOR) < 0 )
+ {
+ OUString uWorkingDir;
+ OSL_VERIFY( osl_getProcessWorkingDir(&uWorkingDir.pData) == osl_Process_E_None );
+ OSL_VERIFY( FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) == FileBase::E_None );
+ } else
+ {
+ OSL_VERIFY( FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) == FileBase::E_None );
+ }
+
+ return uUrlFileName;
+}
+
+OUString LwpTools::DateTimeToOUString(const LtTm &dt)
+{
+ OUString aResult = OUString::number(dt.tm_year) + "-" + OUString::number(dt.tm_mon) + "-" + OUString::number(dt.tm_mday) +
+ "T" + OUString::number(dt.tm_hour) + ":" + OUString::number(dt.tm_min) + ":" + OUString::number(dt.tm_sec);
+
+ return aResult;
+}
+
+/**
+ * @descr get the system date format
+*/
+std::unique_ptr<XFDateStyle> LwpTools::GetSystemDateStyle(bool bLongFormat)
+{
+ icu::DateFormat::EStyle style;
+ if (bLongFormat)
+ style = icu::DateFormat::FULL;//system full date format
+ else
+ style = icu::DateFormat::SHORT;//system short date format
+
+ //1 get locale for system
+ icu::Locale aLocale( LanguageTagIcu::getIcuLocale( Application::GetSettings().GetLanguageTag()));
+ //2 get icu format pattern by locale
+ icu::DateFormat* fmt = icu::DateFormat::createDateInstance(style,aLocale);
+
+ int32_t nLength = 0;
+ int32_t nLengthNeed;
+ UErrorCode status = U_ZERO_ERROR;
+ UChar* pattern = nullptr;
+
+ nLengthNeed = udat_toPattern(reinterpret_cast<void **>(fmt),false,nullptr,nLength,&status);
+ if (status == U_BUFFER_OVERFLOW_ERROR)
+ {
+ status = U_ZERO_ERROR;
+ nLength = nLengthNeed +1;
+ pattern = static_cast<UChar*>(malloc(sizeof(UChar)*nLength));
+ udat_toPattern(reinterpret_cast<void **>(fmt),false,pattern,nLength,&status);
+ }
+ if (pattern == nullptr)
+ return nullptr;
+ // 3 parse pattern string,per icu date/time format syntax, there are 20 letters reserved
+ // as patter letter,each represent an element in date/time and its repeat numbers represent
+ // different format: for example: M produces '1',MM produces '01', MMM produces 'Jan', MMMM produces 'Januaray'
+ // letter other than these letters is regard as text in the format, for example ','in 'Jan,2005'
+ // we parse pattern string letter by letter and get the time format.
+ UChar cSymbol;
+ UChar cTmp;
+ std::unique_ptr<XFDateStyle> pDateStyle(new XFDateStyle);
+
+ for (int32_t i=0;i<nLengthNeed;)
+ {
+ cSymbol = pattern[i];
+ int32_t j;
+ switch(cSymbol)
+ {
+ case 'G':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ pDateStyle->AddEra();
+ break;
+ }
+ case 'y':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j <= 2)
+ pDateStyle->AddYear(false);
+ else
+ pDateStyle->AddYear();
+ break;
+ }
+ case 'M':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddMonth(false);
+ else if (j==2)
+ pDateStyle->AddMonth();
+ else if (j==3)
+ pDateStyle->AddMonth(false,true);
+ else
+ pDateStyle->AddMonth(true,true);
+ break;
+ }
+ case 'd':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddMonthDay(false);
+ else
+ pDateStyle->AddMonthDay();
+ break;
+ }
+ case 'h':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddHour(false);
+ else
+ pDateStyle->AddHour();
+ break;
+ }
+ case 'H':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddHour(false);
+ else
+ pDateStyle->AddHour();
+ break;
+ }
+ case 'm':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddMinute(false);
+ else
+ pDateStyle->AddMinute();
+ break;
+ }
+ case 's':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddSecond(false);
+ else
+ pDateStyle->AddSecond();
+ break;
+ }
+ case 'S':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ /*if (j==1)
+ pDateStyle->AddSecond(sal_False);
+ else
+ pDateStyle->AddSecond();*/
+ break;
+ }
+ case 'E':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j<=2)
+ pDateStyle->AddWeekDay(false);
+ else
+ pDateStyle->AddWeekDay();
+ break;
+ }
+ case 'D':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ /*if (j==1)
+ pDateStyle->AddWeekDay(sal_False);
+ else
+ pDateStyle->AddWeekDay();*/
+ break;
+ }
+ case 'F':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ /*if (j==1)
+ pDateStyle->AddWeekDay(sal_False);
+ else
+ pDateStyle->AddWeekDay();*/
+ break;
+ }
+ case 'w':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ /*if (j==1)
+ pDateStyle->AddWeekDay(sal_False);
+ else
+ pDateStyle->AddWeekDay();*/
+ break;
+ }
+ case 'W':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ /*if (j==1)
+ pDateStyle->AddWeekDay(sal_False);
+ else
+ pDateStyle->AddWeekDay();*/
+ break;
+ }
+ case 'a':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ pDateStyle->AddAmPm();
+ break;
+ }
+ case 'k':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ break;
+ }
+ case 'K':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pDateStyle->AddHour(false);
+ else
+ pDateStyle->AddHour();
+ break;
+ }
+ case 'Z':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ break;
+ }
+ case '\''://'
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ break;
+ }
+ case '"':
+ {
+ pDateStyle->AddText("'");
+ break;
+ }
+ default:
+ {
+ if ((cSymbol>='A' && cSymbol<='Z') || (cSymbol>='a' && cSymbol<='z') )
+ {
+ return nullptr;
+ }
+ else//TEXT
+ {
+ //UChar buffer[1024];
+ sal_Unicode buffer[1024];
+ buffer[0] = cSymbol;
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if ((cTmp>='A' && cTmp<='Z') || (cTmp>='a' && cTmp<='z') ||
+ cTmp=='\'' || cTmp=='"' )
+ {
+ i=i+j;
+ buffer[j]= '\0';
+ break;
+ }
+ else
+ buffer[j] = cTmp;
+ }
+
+ pDateStyle->AddText(OUString(buffer));//keep for all parsed
+ }
+ break;
+ }
+ }
+ }
+// udat_close(fmt);
+ return pDateStyle;
+}
+/**
+ * @descr get the system time format
+*/
+std::unique_ptr<XFTimeStyle> LwpTools::GetSystemTimeStyle()
+{
+ //1 get locale for system
+ icu::Locale aLocale( LanguageTagIcu::getIcuLocale( Application::GetSettings().GetLanguageTag()));
+ //2 get icu format pattern by locale
+ icu::DateFormat* fmt = icu::DateFormat::createTimeInstance(icu::DateFormat::DEFAULT,aLocale);
+
+ int32_t nLength = 0;
+ int32_t nLengthNeed;
+ UErrorCode status = U_ZERO_ERROR;
+ UChar* pattern = nullptr;
+ nLengthNeed = udat_toPattern(reinterpret_cast<void **>(fmt),false,nullptr,nLength,&status);
+ if (status == U_BUFFER_OVERFLOW_ERROR)
+ {
+ status = U_ZERO_ERROR;
+ nLength = nLengthNeed +1;
+ pattern = static_cast<UChar*>(malloc(sizeof(UChar)*nLength));
+ udat_toPattern(reinterpret_cast<void **>(fmt),false,pattern,nLength,&status);
+ }
+
+ if (pattern == nullptr)
+ return nullptr;
+ // 3 parse pattern string,per icu date/time format syntax, there are 20 letters reserved
+ // as patter letter,each represent an element in date/time and its repeat numbers represent
+ // different format: for example: M produces '1',MM produces '01', MMM produces 'Jan', MMMM produces 'Januaray'
+ // letter other than these letters is regard as text in the format, for example ','in 'Jan,2005'
+ // we parse pattern string letter by letter and get the time format.
+ // for time format ,for there is not date info,we can only parse the letter representing time.
+ UChar cSymbol;
+ UChar cTmp;
+ std::unique_ptr<XFTimeStyle> pTimeStyle(new XFTimeStyle);
+
+ for (int32_t i=0;i<nLengthNeed;)
+ {
+ cSymbol = pattern[i];
+ int32_t j;
+ switch(cSymbol)
+ {
+ case 'h':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pTimeStyle->AddHour(false);
+ else
+ pTimeStyle->AddHour();
+ break;
+ }
+ case 'H':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pTimeStyle->AddHour(false);
+ else
+ pTimeStyle->AddHour();
+ break;
+ }
+ case 'm':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pTimeStyle->AddMinute(false);
+ else
+ pTimeStyle->AddMinute();
+ break;
+ }
+ case 's':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pTimeStyle->AddSecond(false);
+ else
+ pTimeStyle->AddSecond();
+ break;
+ }
+ case 'S':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ /*if (j==1)
+ pDateStyle->AddSecond(sal_False);
+ else
+ pDateStyle->AddSecond();*/
+ break;
+ }
+ case 'a':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ pTimeStyle->SetAmPm(true);
+ break;
+ }
+ case 'k':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ break;
+ }
+ case 'K':
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ if (j==1)
+ pTimeStyle->AddHour(false);
+ else
+ pTimeStyle->AddHour();
+ break;
+ }
+ case '\''://'
+ {
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if (cTmp != cSymbol)
+ {
+ i=i+j;
+ break;
+ }
+ }
+ break;
+ }
+ case '"':
+ {
+ pTimeStyle->AddText("'");
+ break;
+ }
+ default:
+ {
+ if ((cSymbol>='A' && cSymbol<='Z') || (cSymbol>='a' && cSymbol<='z') )
+ {
+ return nullptr;
+ }
+ else//TEXT
+ {
+ sal_Unicode buffer[1024];
+ buffer[0] = cSymbol;
+ //strBuffer.append(cSymbol);
+ for (j=1;;j++)
+ {
+ cTmp = pattern[i+j];
+ if ((cTmp>='A' && cTmp<='Z') || (cTmp>='a' && cTmp<='z') ||
+ cTmp=='\'' || cTmp=='"' )
+ {
+ i=i+j;
+ buffer[j]= '\0';
+ break;
+ }
+ else
+ buffer[j] = cTmp;
+ }
+ pTimeStyle->AddText(OUString(buffer));//keep for all parsed
+ }
+ break;
+ }
+ }
+ }
+// udat_close(fmt);
+ return pTimeStyle;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpuidoc.cxx b/lotuswordpro/source/filter/lwpuidoc.cxx
new file mode 100644
index 000000000..8e26b0dae
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpuidoc.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpuidoc.hxx"
+
+LwpUIDocument::LwpUIDocument(LwpObjectStream *pStrm)
+ : m_nFlags(DOC_LOCKED)
+{
+ Read(pStrm);
+}
+
+LwpUIDocument::~LwpUIDocument()
+{}
+
+void LwpUIDocument::Read(LwpObjectStream *pStrm)
+{
+ LwpNamedProperties::Read(pStrm);
+ m_ARMacroOpts.Read(pStrm);
+ m_MergedOpts.Read(pStrm);
+ m_SheetFullPath.ReadPathAtom(pStrm);
+
+ sal_uInt16 saved_flags = pStrm->QuickReaduInt16();
+ m_nFlags |= saved_flags;
+
+ if(pStrm->CheckExtra())
+ {
+ m_InitialSaveAsType.Read(pStrm);
+ pStrm->SkipExtra();
+ }
+}
+/**
+ * @descr Read macro options from object stream
+ **/
+void LwpNamedProperties::Read(LwpObjectStream *pStrm)
+{
+ sal_uInt16 numEntries = pStrm->QuickReaduInt16();
+
+ if (numEntries)
+ throw std::runtime_error("TODO: Read each NamedProperties");
+
+ pStrm->SkipExtra();
+}
+/**
+ * @descr Read macro options from object stream
+ **/
+void LwpAutoRunMacroOptions::Read(LwpObjectStream *pStrm)
+{
+ m_OpenName.ReadPathAtom(pStrm);
+ m_CloseName.ReadPathAtom(pStrm);
+ m_NewName.ReadPathAtom(pStrm);
+ m_OptionFlag = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+/**
+ * @descr Read merge options from object stream
+ **/
+void LwpMergeOptions::Read(LwpObjectStream *pStrm)
+{
+ m_RecordFile.ReadPathAtom(pStrm);
+ m_DescriptionFile.ReadPathAtom(pStrm);
+ m_Filter.Read(pStrm);
+ m_nType = pStrm->QuickReaduInt16();
+
+ //Does not process m_nType here. Assume m_nType is 0.
+ if (m_nType != 0)
+ throw std::runtime_error("TODO: Read the CMergeDataFile");
+
+ m_nLastActionFlag = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpuidoc.hxx b/lotuswordpro/source/filter/lwpuidoc.hxx
new file mode 100644
index 000000000..21fee29ba
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpuidoc.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * all classes for LwpUIDocument
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPUIDOC_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPUIDOC_HXX
+
+#include <config_lgpl.h>
+
+class LwpNamedProperties;
+class LwpAutoRunMacroOptions;
+class LwpMergeOptions;
+
+#include <lwpobjstrm.hxx>
+#include <lwpatomholder.hxx>
+/**
+ * @brief Properties in UIDocument structure
+ * not parsed yet
+*/
+class LwpNamedProperties
+{
+public:
+ LwpNamedProperties() = delete;
+ static void Read(LwpObjectStream *pStrm);
+};
+/**
+ * @brief macro options contained in UIDocument structure
+ * not parsed yet
+*/
+class LwpAutoRunMacroOptions
+{
+public:
+ LwpAutoRunMacroOptions()
+ : m_OptionFlag(0)
+ {}
+private:
+ LwpAtomHolder m_OpenName;
+ LwpAtomHolder m_CloseName;
+ LwpAtomHolder m_NewName;
+ sal_uInt16 m_OptionFlag;
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+/**
+ * @brief Merge options contained in UIDocument structure
+ * not parsed yet
+*/
+class LwpMergeOptions
+{
+public:
+ LwpMergeOptions()
+ : m_nType(0)
+ , m_nLastActionFlag(0)
+ {}
+private:
+ LwpAtomHolder m_RecordFile;
+ LwpAtomHolder m_DescriptionFile;
+ LwpAtomHolder m_Filter;
+ sal_uInt16 m_nType;
+ sal_uInt16 m_nLastActionFlag; // flag remembers last merge action
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+/**
+ * @brief UIDocument structure contained in VO_DOCUMENT
+ * not parsed yet
+*/
+class LwpUIDocument
+{
+public:
+ explicit LwpUIDocument(LwpObjectStream *pStrm);
+ ~LwpUIDocument();
+private:
+ LwpAutoRunMacroOptions m_ARMacroOpts;
+ LwpMergeOptions m_MergedOpts;
+ LwpAtomHolder m_SheetFullPath; // full path for style sheet
+ sal_uInt16 m_nFlags;
+ LwpAtomHolder m_InitialSaveAsType;
+ enum
+ {
+ DOC_READONLY = 0x01,
+ DOC_BLOCKSETS = 0x02,
+ DOC_LOCKED = 0x04,
+ DOC_ENVELOPE = 0x08,
+ DOC_EXTERNALFILE = 0x10,
+ DOC_SANITYCHECK = 0x20,
+ DOC_ANNOTATEONLY = 0x40,
+ DOC_CANCELED = 0x80
+ };
+public:
+ void Read(LwpObjectStream *pStrm);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpusewhen.hxx b/lotuswordpro/source/filter/lwpusewhen.hxx
new file mode 100644
index 000000000..21b5ce7f0
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpusewhen.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPUSEWHEN_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPUSEWHEN_HXX
+
+#include <config_lgpl.h>
+#include <lwpobjstrm.hxx>
+
+#define STYLE_USEONALLPAGES 0x0001U /* repeat on all pages */
+#define STYLE_USEONALLEVENPAGES 0x0002U /* repeat on all even pages */
+#define STYLE_USEONALLODDPAGES 0x0004U /* repeat on all odd pages */
+#define STYLE_USEONTHISPAGE 0x0008U /* use this guy on this page */
+#define STYLE_USEEXCEPTTHISPAGE 0x0010U /* use guy except on this page */
+#define STYLE_USESTARTINGONPAGE 0x0020U /* use starting on page n */
+#define STYLE_USEONMASK (STYLE_USEONALLPAGES | \
+ STYLE_USEONALLEVENPAGES | \
+ STYLE_USEONALLODDPAGES | \
+ STYLE_USEONTHISPAGE | \
+ STYLE_USEEXCEPTTHISPAGE | \
+ STYLE_USESTARTINGONPAGE)
+
+#define STYLE_STARTONNEXTPAGE 0x0000U // This is the default
+#define STYLE_STARTONTHISPAGE 0x0040U
+#define STYLE_STARTONNEXTODD 0x0080U
+#define STYLE_STARTONNEXTEVEN 0x0100U
+#define STYLE_STARTONTHISHF 0x0200U
+#define STYLE_STARTONMASK (STYLE_STARTONTHISPAGE | \
+ STYLE_STARTONNEXTODD | \
+ STYLE_STARTONNEXTEVEN | \
+ STYLE_STARTONTHISHF)
+class LwpUseWhen
+{
+public:
+ LwpUseWhen() : m_nFlags(0), m_nUsePage(0) {}
+
+ inline void Read(LwpObjectStream* pStrm);
+
+ inline bool IsUseOnAllPages() const;
+ inline bool IsUseOnAllEvenPages() const;
+ inline bool IsUseOnAllOddPages() const;
+ inline bool IsUseOnPage() const;
+
+ inline bool IsStartOnThisPage() const;
+ inline bool IsStartOnNextPage() const;
+ inline bool IsStartOnNextEvenPage() const;
+ inline bool IsStartOnNextOddPage() const;
+ inline bool IsStartOnThisHF() const;
+
+ inline sal_uInt16 GetUsePage() const;
+private:
+ sal_uInt16 m_nFlags;
+ sal_uInt16 m_nUsePage;
+};
+
+inline void LwpUseWhen::Read(LwpObjectStream* pStrm)
+{
+ m_nFlags = pStrm->QuickReaduInt16();
+ m_nUsePage = pStrm->QuickReaduInt16();
+ pStrm->SkipExtra();
+}
+inline bool LwpUseWhen::IsUseOnAllPages() const
+{
+ return ((m_nFlags & STYLE_USEONALLPAGES) != 0);
+}
+inline bool LwpUseWhen::IsUseOnAllEvenPages() const
+{
+ return ((m_nFlags & STYLE_USEONALLEVENPAGES) != 0);
+}
+inline bool LwpUseWhen::IsUseOnAllOddPages() const
+{
+ return ((m_nFlags & STYLE_USEONALLODDPAGES) != 0);
+}
+
+inline bool LwpUseWhen::IsUseOnPage() const
+{
+ return ((m_nFlags & STYLE_USEONTHISPAGE) != 0);
+}
+
+inline bool LwpUseWhen::IsStartOnThisPage() const
+{
+ return ((m_nFlags & STYLE_STARTONTHISPAGE) != 0);
+}
+
+inline bool LwpUseWhen::IsStartOnNextPage() const
+{
+ return ((m_nFlags & STYLE_STARTONMASK) == 0);
+}
+
+inline bool LwpUseWhen::IsStartOnNextOddPage() const
+{
+ return ((m_nFlags & STYLE_STARTONNEXTODD) != 0);
+}
+
+inline bool LwpUseWhen::IsStartOnNextEvenPage() const
+{
+ return ((m_nFlags & STYLE_STARTONNEXTEVEN) != 0);
+}
+
+inline bool LwpUseWhen::IsStartOnThisHF() const
+{
+ return ((m_nFlags & STYLE_STARTONTHISHF) != 0);
+}
+
+inline sal_uInt16 LwpUseWhen::GetUsePage() const
+{
+ return m_nUsePage;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpusrdicts.cxx b/lotuswordpro/source/filter/lwpusrdicts.cxx
new file mode 100644
index 000000000..f43623684
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpusrdicts.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include "lwpusrdicts.hxx"
+#include <lwpatomholder.hxx>
+
+LwpUserDictFiles::LwpUserDictFiles(LwpObjectStream *pStrm)
+{
+ Read(pStrm);
+}
+/**
+ * @descr Read UserDictFiles in VO_DOCUMENT
+ * words are skipped, not parsed yet
+ **/
+void LwpUserDictFiles::Read(LwpObjectStream *pStrm)
+{
+ sal_uInt16 cnt = pStrm->QuickReaduInt16();
+ LwpAtomHolder word;
+ while(cnt--)
+ {
+ word.Read(pStrm);
+ pStrm->SkipExtra();
+ }
+ pStrm->SkipExtra();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpusrdicts.hxx b/lotuswordpro/source/filter/lwpusrdicts.hxx
new file mode 100644
index 000000000..49ac08d69
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpusrdicts.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPUSRDICTS_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPUSRDICTS_HXX
+
+#include <config_lgpl.h>
+#include <lwpobjstrm.hxx>
+/**
+ * @brief User defined words used in VO_DOCUMENT
+*/
+class LwpUserDictFiles
+{
+public:
+ explicit LwpUserDictFiles(LwpObjectStream* pStrm);
+ static void Read(LwpObjectStream* pStrm);
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpverdocument.cxx b/lotuswordpro/source/filter/lwpverdocument.cxx
new file mode 100644
index 000000000..4a228a7a6
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpverdocument.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Versioned Pointer object, used for VO_VEGTR and VO_QTR
+ * Does not find the difference between CVersionedQointer and
+ * CVersionedGointer, so use one class
+ ************************************************************************/
+
+#include <lwpglobalmgr.hxx>
+#include "lwpverdocument.hxx"
+#include "lwplnopts.hxx"
+#include "lwpproplist.hxx"
+#include <xfilter/xfparastyle.hxx>
+#include <lwptools.hxx>
+
+LwpVerDocument::LwpVerDocument(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+ , m_nTabSpacing(0)
+{
+}
+
+void LwpVerDocument::Read()
+{
+ m_nTabSpacing = m_pObjStrm->QuickReaduInt32();
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ LwpLineNumberOptions aLineNumberOptions(m_pObjStrm.get());
+
+ if (m_pObjStrm->CheckExtra())
+ {
+ LwpPropList aPropList;
+ aPropList.Read(m_pObjStrm.get());
+ m_pObjStrm->SkipExtra();
+ }
+ }
+}
+
+void LwpVerDocument::RegisterStyle()
+{
+ std::unique_ptr<XFDefaultParaStyle> pDefault(new XFDefaultParaStyle);
+ double len = static_cast<double>(m_nTabSpacing) / UNITS_PER_INCH * CM_PER_INCH;
+ if (len < 0.001)
+ {
+ len = 1.27; //0.5 inch
+ }
+ pDefault->SetTabDistance(len);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->AddStyle(std::move(pDefault));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpverdocument.hxx b/lotuswordpro/source/filter/lwpverdocument.hxx
new file mode 100644
index 000000000..b77bd7bad
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpverdocument.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Versioned Pointer object, used for VO_VEGTR and VO_QTR
+ * Does not find the difference between CVersionedQointer and
+ * CVersionedGointer, so use one class
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPVERDOCUMENT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPVERDOCUMENT_HXX
+
+#include <lwpobj.hxx>
+
+/*VO_VERDOCUMENT*/
+
+class LwpVerDocument : public LwpObject
+{
+public:
+ LwpVerDocument(LwpObjectHeader const& objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ virtual void RegisterStyle() override;
+
+private:
+ virtual ~LwpVerDocument() override {}
+
+ sal_uInt32 m_nTabSpacing;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpvpointer.cxx b/lotuswordpro/source/filter/lwpvpointer.cxx
new file mode 100644
index 000000000..29599e69f
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpvpointer.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "lwpvpointer.hxx"
+#include <lwpfilehdr.hxx>
+
+LwpVersionedPointer::LwpVersionedPointer(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
+ : LwpObject(objHdr, pStrm)
+{}
+
+void LwpVersionedPointer::Read()
+{
+ m_PointerID.ReadIndexed(m_pObjStrm.get());
+ if( LwpFileHeader::m_nFileRevision < 0x0006 )
+ m_pObjStrm->SkipExtra();
+}
+
+void LwpVersionedPointer::Parse(IXFStream* /*pOutputStream*/)
+{
+}
+
+void LwpVersionedPointer::RegisterStyle()
+{
+ rtl::Reference<LwpObject> pObj = m_PointerID.obj();
+ if( pObj.is() )
+ {
+ pObj->SetFoundry(m_pFoundry);
+ pObj->DoRegisterStyle();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpvpointer.hxx b/lotuswordpro/source/filter/lwpvpointer.hxx
new file mode 100644
index 000000000..bce43a204
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpvpointer.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Versioned Pointer object, used for VO_VEGTR and VO_QTR
+ * Does not find the difference between CVersionedQointer and
+ * CVersionedGointer, so use one class
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPVPOINTER_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPVPOINTER_HXX
+
+#include <lwpobj.hxx>
+class LwpVersionedPointer final : public LwpObject
+{
+public:
+ LwpVersionedPointer(LwpObjectHeader const& objHdr, LwpSvStream* pStrm);
+ void Read() override;
+ void RegisterStyle() override;
+ void Parse(IXFStream* pOutputStream) override;
+ LwpObjectID& GetPointer() { return m_PointerID; }
+
+private:
+ LwpObjectID m_PointerID;
+ virtual ~LwpVersionedPointer() override {}
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx
new file mode 100644
index 000000000..18a062d1b
--- /dev/null
+++ b/lotuswordpro/source/filter/tocread.cxx
@@ -0,0 +1,517 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <sal/config.h>
+#include <sal/log.hxx>
+
+#include <cstring>
+
+#include "first.hxx"
+#include "bentoid.hxx"
+#include "tocread.hxx"
+#include "ut.hxx"
+#include <assert.h>
+namespace OpenStormBento
+{
+
+BenError
+CBenTOCReader::ReadLabelAndTOC()
+{
+ BenError Err;
+
+ unsigned long TOCOffset;
+ if ((Err = ReadLabel(&TOCOffset, &cTOCSize)) != BenErr_OK)
+ return Err;
+
+ sal_uLong nLength = cpContainer->GetSize();
+
+ if (TOCOffset > nLength)
+ return BenErr_ReadPastEndOfTOC;
+
+ if (cTOCSize > nLength - TOCOffset)
+ return BenErr_ReadPastEndOfTOC;
+
+ cpContainer->SeekToPosition(TOCOffset);
+
+ cpTOC.reset( new BenByte[cTOCSize] );
+ if ((Err = cpContainer->ReadKnownSize(cpTOC.get(), cTOCSize)) != BenErr_OK)
+ return Err;
+
+ if ((Err = ReadTOC()) != BenErr_OK)
+ return Err;
+
+ return BenErr_OK;
+}
+
+BenError
+CBenTOCReader::ReadLabel(unsigned long * pTOCOffset, unsigned long * pTOCSize)
+{
+ // If seek fails, then probably because stream is smaller than
+ // BEN_LABEL_SIZE and thus can't be Bento container
+ BenError Err;
+ cpContainer->SeekFromEnd(-BEN_LABEL_SIZE);
+
+ BenByte Label[BEN_LABEL_SIZE];
+ if ((Err = cpContainer->ReadKnownSize(Label, BEN_LABEL_SIZE)) != BenErr_OK)
+ return Err;
+
+ if (memcmp(Label, gsBenMagicBytes, BEN_MAGIC_BYTES_SIZE) != 0)
+ if ((Err = SearchForLabel(Label)) != BenErr_OK)
+ return Err;
+
+ BenByte * pCurrLabel = Label + BEN_MAGIC_BYTES_SIZE;
+
+ BenWord Flags =
+ UtGetIntelWord(pCurrLabel);
+ pCurrLabel += 2; // Flags
+ // Newer files are 0x0101--indicates if big or little endian. Older
+ // files are 0x0 for flags
+ if (Flags != 0x0101 && Flags != 0x0)
+ return BenErr_UnknownBentoFormatVersion;
+
+ cBlockSize = UtGetIntelWord(pCurrLabel) * 1024; pCurrLabel += 2;
+ if (cBlockSize == 0)
+ return BenErr_NotBentoContainer;
+
+ // Check major version
+ if (UtGetIntelWord(pCurrLabel) != BEN_CURR_MAJOR_VERSION)
+ return BenErr_UnknownBentoFormatVersion;
+ pCurrLabel += 2;
+
+ pCurrLabel += 2; // Minor version
+
+ *pTOCOffset = UtGetIntelDWord(pCurrLabel); pCurrLabel += 4;
+ *pTOCSize = UtGetIntelDWord(pCurrLabel);
+
+ assert(pCurrLabel + 4 == Label + BEN_LABEL_SIZE);
+
+ return BenErr_OK;
+}
+
+#define LABEL_READ_BUFFER_SIZE 500
+#define MAX_SEARCH_AMOUNT 1024 * 1024
+
+BenError
+CBenTOCReader::SearchForLabel(BenByte * pLabel)
+{
+ BenError Err;
+
+ sal_uLong Length = cpContainer->GetSize();
+
+ // Always ready to check for MagicBytes from
+ // CurrOffset - BEN_MAGIC_BYTES_SIZE to CurrOffset - 1
+ unsigned long CurrOffset = Length - BEN_LABEL_SIZE + BEN_MAGIC_BYTES_SIZE -
+ 1;
+
+ char Buffer[LABEL_READ_BUFFER_SIZE] = {0};
+
+ unsigned long BufferStartOffset = Length; // Init to big value
+
+ while (CurrOffset >= BEN_MAGIC_BYTES_SIZE)
+ {
+ // Don't search backwards more than 1 meg
+ if (Length - CurrOffset > MAX_SEARCH_AMOUNT)
+ break;
+
+ // If before beginning of buffer
+ if (CurrOffset - BEN_MAGIC_BYTES_SIZE < BufferStartOffset)
+ {
+ unsigned long UsedBufferSize;
+ if (CurrOffset < LABEL_READ_BUFFER_SIZE)
+ UsedBufferSize = CurrOffset;
+ else UsedBufferSize = LABEL_READ_BUFFER_SIZE;
+
+ cpContainer->SeekToPosition(CurrOffset - UsedBufferSize);
+
+ if ((Err = cpContainer->ReadKnownSize(Buffer, UsedBufferSize)) !=
+ BenErr_OK)
+ return Err;
+
+ BufferStartOffset = CurrOffset - UsedBufferSize;
+ }
+
+ if (memcmp(Buffer + (CurrOffset - BEN_MAGIC_BYTES_SIZE -
+ BufferStartOffset), gsBenMagicBytes, BEN_MAGIC_BYTES_SIZE) == 0)
+ {
+ cpContainer->SeekToPosition(CurrOffset -
+ BEN_MAGIC_BYTES_SIZE);
+
+ return cpContainer->ReadKnownSize(pLabel, BEN_LABEL_SIZE);
+ }
+
+ --CurrOffset;
+ }
+
+ return BenErr_NotBentoContainer; // Didn't find magic bytes
+}
+
+BenError
+CBenTOCReader::ReadTOC()
+{
+ BenError Err;
+ BenByte LookAhead = GetCode();
+ BenGeneration Generation = 0;
+
+ // Read in all objects
+ while (LookAhead == BEN_NEW_OBJECT)
+ {
+ BenObjectID ObjectID;
+ if ((Err = GetDWord(&ObjectID)) != BenErr_OK)
+ return Err;
+ CBenObject * pObject = nullptr;
+
+ // Read in all properties for object
+ do
+ {
+ BenObjectID PropertyID;
+
+ if ((Err = GetDWord(&PropertyID)) != BenErr_OK)
+ return Err;
+ CBenProperty * pProperty = nullptr;
+
+ // Read in all values for property
+ do
+ {
+ BenObjectID ReferencedListID = 0;
+
+ BenObjectID TypeID;
+ if ((Err = GetDWord(&TypeID)) != BenErr_OK)
+ return Err;
+ LookAhead = GetCode();
+
+ if (LookAhead == BEN_EXPLICIT_GEN)
+ {
+ if ((Err = GetDWord(&Generation)) != BenErr_OK)
+ return Err;
+ LookAhead = GetCode();
+ }
+
+ if (LookAhead == BEN_REFERENCE_LIST_ID)
+ {
+ if ((Err = GetDWord(&ReferencedListID)) != BenErr_OK)
+ return Err;
+ LookAhead = GetCode();
+ }
+
+ if (PropertyID == BEN_PROPID_GLOBAL_PROPERTY_NAME ||
+ PropertyID == BEN_PROPID_GLOBAL_TYPE_NAME)
+ {
+ // Read property or type name
+
+ if (pObject != nullptr || TypeID != BEN_TYPEID_7_BIT_ASCII ||
+ LookAhead != BEN_OFFSET4_LEN4)
+ return BenErr_NamedObjectError;
+
+ BenContainerPos Pos;
+ sal_uInt32 Length;
+
+ if ((Err = GetDWord(&Pos)) != BenErr_OK)
+ return Err;
+ if ((Err = GetDWord(&Length)) != BenErr_OK)
+ return Err;
+ LookAhead = GetCode();
+
+ cpContainer->SeekToPosition(Pos);
+
+ const auto nRemainingSize = cpContainer->remainingSize();
+ if (Length > nRemainingSize)
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ Length = nRemainingSize;
+ }
+
+ #define STACK_BUFFER_SIZE 256
+ char sStackBuffer[STACK_BUFFER_SIZE];
+ std::unique_ptr<char[]> sAllocBuffer;
+ char * sBuffer;
+ if (Length > STACK_BUFFER_SIZE)
+ {
+ sAllocBuffer.reset(new char[Length]);
+ sBuffer = sAllocBuffer.get();
+ }
+ else
+ {
+ sBuffer = sStackBuffer;
+ }
+
+ if ((Err = cpContainer->ReadKnownSize(sBuffer, Length)) !=
+ BenErr_OK)
+ {
+ return Err;
+ }
+
+ OString sName;
+ if (Length)
+ sName = OString(sBuffer, Length - 1);
+
+ CUtListElmt * pPrevNamedObjectListElmt;
+ if (FindNamedObject(&cpContainer->GetNamedObjects(),
+ sName, &pPrevNamedObjectListElmt) != nullptr)
+ {
+ return BenErr_DuplicateName;
+ }
+
+ CUtListElmt* pPrevObject = cpContainer->GetObjects().GetLast();
+
+ if (PropertyID == BEN_PROPID_GLOBAL_PROPERTY_NAME)
+ pObject = new CBenPropertyName(cpContainer, ObjectID,
+ pPrevObject, sName, pPrevNamedObjectListElmt);
+ else
+ pObject = new CBenTypeName(cpContainer, ObjectID,
+ pPrevObject, sName, pPrevNamedObjectListElmt);
+ }
+ else if (PropertyID == BEN_PROPID_OBJ_REFERENCES)
+ {
+ // Don't need to read in references object--we assume
+ // that all references use object ID as key
+ if ((Err = ReadSegments(nullptr, &LookAhead)) != BenErr_OK)
+ return Err;
+ }
+ else if (ObjectID == BEN_OBJID_TOC)
+ {
+ if (PropertyID == BEN_PROPID_TOC_SEED)
+ {
+ if (TypeID != BEN_TYPEID_TOC_TYPE ||
+ LookAhead != BEN_IMMEDIATE4)
+ return BenErr_TOCSeedError;
+
+ BenDWord Data;
+ if ((Err = GetDWord(&Data)) != BenErr_OK)
+ return Err;
+ LookAhead = GetCode();
+
+ cpContainer->SetNextAvailObjectID(Data);
+ }
+ else
+ {
+ // Ignore the other BEN_OBJID_TOC properties
+ if ((Err = ReadSegments(nullptr, &LookAhead)) != BenErr_OK)
+ return Err;
+ }
+ }
+ else
+ {
+ if (pProperty != nullptr)
+ return BenErr_PropertyWithMoreThanOneValue;
+
+ if (pObject == nullptr)
+ pObject = new CBenObject(cpContainer, ObjectID,
+ cpContainer->GetObjects().GetLast());
+
+ pProperty = new CBenProperty(pObject, PropertyID, TypeID,
+ pObject->GetProperties().GetLast());
+
+ if ((Err = ReadSegments(&pProperty->UseValue(),
+ &LookAhead)) != BenErr_OK)
+ return Err;
+ }
+ } while (LookAhead == BEN_NEW_TYPE);
+ } while (LookAhead == BEN_NEW_PROPERTY);
+ }
+
+ if (LookAhead == BEN_READ_PAST_END_OF_TOC)
+ return BenErr_OK;
+ else return BenErr_InvalidTOC;
+}
+
+BenError
+CBenTOCReader::ReadSegments(CBenValue * pValue, BenByte * pLookAhead)
+{
+ BenError Err;
+
+ while (*pLookAhead >= BEN_SEGMENT_CODE_START &&
+ *pLookAhead <= BEN_SEGMENT_CODE_END)
+ {
+ if ((Err = ReadSegment(pValue, pLookAhead)) !=
+ BenErr_OK)
+ return Err;
+ }
+
+ return BenErr_OK;
+}
+
+BenError
+CBenTOCReader::ReadSegment(CBenValue * pValue, BenByte * pLookAhead)
+{
+ BenError Err;
+
+ bool Immediate = false;
+ bool EightByteOffset = false;
+ sal_uInt32 Offset(0), Length(0);
+
+ switch (*pLookAhead)
+ {
+ case BEN_CONT_OFFSET4_LEN4:
+ case BEN_OFFSET4_LEN4:
+ if ((Err = GetDWord(&Offset)) != BenErr_OK)
+ return Err;
+ if ((Err = GetDWord(&Length)) != BenErr_OK)
+ return Err;
+ break;
+
+ case BEN_IMMEDIATE0:
+ Length = 0; Immediate = true;
+ break;
+
+ case BEN_IMMEDIATE1:
+ Length = 1; Immediate = true;
+ break;
+
+ case BEN_IMMEDIATE2:
+ Length = 2; Immediate = true;
+ break;
+
+ case BEN_IMMEDIATE3:
+ Length = 3; Immediate = true;
+ break;
+
+ case BEN_CONT_IMMEDIATE4:
+ case BEN_IMMEDIATE4:
+ Length = 4; Immediate = true;
+ break;
+
+ case BEN_CONT_OFFSET8_LEN4:
+ case BEN_OFFSET8_LEN4:
+ EightByteOffset = true;
+ break;
+
+ default:
+ return BenErr_OK;
+ }
+
+ BenByte ImmData[4];
+ if (Immediate && Length != 0)
+ if ((Err = GetData(ImmData, 4)) != BenErr_OK)
+ return Err;
+
+ *pLookAhead = GetCode();
+
+ if (EightByteOffset)
+ return BenErr_64BitOffsetNotSupported;
+
+ if (pValue != nullptr)
+ {
+ if (! Immediate)
+ new CBenValueSegment(pValue, Offset, Length);
+ else if (Length != 0)
+ {
+ assert(Length <= 4);
+ new CBenValueSegment(pValue, ImmData, static_cast<unsigned short>(Length));
+ }
+ }
+
+ return BenErr_OK;
+}
+
+bool
+CBenTOCReader::CanGetData(unsigned long Amt)
+{
+ return cCurr + Amt <= cTOCSize;
+}
+
+BenError
+CBenTOCReader::GetByte(BenByte * pByte)
+{
+ if (! CanGetData(1))
+ return BenErr_ReadPastEndOfTOC;
+
+ *pByte = UtGetIntelByte(cpTOC.get() + cCurr);
+ ++cCurr;
+ return BenErr_OK;
+}
+
+BenError
+CBenTOCReader::GetDWord(BenDWord * pDWord)
+{
+ if (! CanGetData(4))
+ return BenErr_ReadPastEndOfTOC;
+
+ *pDWord = UtGetIntelDWord(cpTOC.get() + cCurr);
+ cCurr += 4;
+ return BenErr_OK;
+}
+
+BenByte
+CBenTOCReader::GetCode()
+{
+ BenByte Code;
+ do
+ {
+ if (GetByte(&Code) != BenErr_OK)
+ return BEN_READ_PAST_END_OF_TOC;
+
+ if (Code == BEN_END_OF_BUFFER)
+ // Advance to next block
+ cCurr = cBlockSize * ((cCurr + (cBlockSize - 1)) /
+ cBlockSize);
+ }
+ while (Code == BEN_NOOP || Code == BEN_END_OF_BUFFER);
+ return Code;
+}
+
+BenError
+CBenTOCReader::GetData(void * pBuffer, unsigned long Amt)
+{
+ if (! CanGetData(Amt))
+ return BenErr_ReadPastEndOfTOC;
+
+ std::memcpy(pBuffer, cpTOC.get() + cCurr, Amt);
+ cCurr += Amt;
+ return BenErr_OK;
+}
+}//end OpenStormBento namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/tocread.hxx b/lotuswordpro/source/filter/tocread.hxx
new file mode 100644
index 000000000..b2645b0af
--- /dev/null
+++ b/lotuswordpro/source/filter/tocread.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_TOCREAD_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_TOCREAD_HXX
+
+#include "bento.hxx"
+#include <memory>
+
+namespace OpenStormBento
+{
+
+class CBenTOCReader
+{
+public: // Methods
+ explicit CBenTOCReader(LtcBenContainer * pContainer)
+ : cpContainer(pContainer)
+ , cBlockSize(0)
+ , cCurr(0)
+ , cTOCSize(0)
+ { }
+ BenError ReadLabelAndTOC();
+
+private: // Methods
+ BenError ReadLabel(unsigned long * pTOCOffset, unsigned long * pTOCSize);
+ BenError SearchForLabel(BenByte * pLabel);
+ BenError ReadTOC();
+ BenError ReadSegments(CBenValue * pValue, BenByte * pLookAhead);
+ BenError ReadSegment(CBenValue * pValue, BenByte * pLookAhead);
+ bool CanGetData(unsigned long Amt);
+ BenError GetByte(BenByte * pByte);
+ BenError GetDWord(BenDWord * pDWord);
+ BenByte GetCode();
+ BenError GetData(void * pBuffer, unsigned long Amt);
+
+private: // Data
+ LtcBenContainer * cpContainer;
+ std::unique_ptr<BenByte[]> cpTOC;
+ unsigned long cBlockSize;
+ unsigned long cCurr;
+ unsigned long cTOCSize;
+};
+}//end namespace OpenStormBento
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/ut.hxx b/lotuswordpro/source/filter/ut.hxx
new file mode 100644
index 000000000..c499e9c78
--- /dev/null
+++ b/lotuswordpro/source/filter/ut.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_UT_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_UT_HXX
+# include <sal/types.h>
+
+namespace OpenStormBento
+{
+
+inline sal_uInt16 UtGetIntelWord(sal_uInt8 const * pData)
+{ return pData[0] | pData[1] << 8; }
+
+inline sal_uInt32 UtGetIntelDWord(sal_uInt8 const * pData)
+{ return pData[0] | pData[1] << 8 | pData[2] << 16 | pData[3] << 24; }
+
+inline sal_uInt8 UtGetIntelByte(sal_uInt8 const * pData)
+{ return * pData; }
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/utbenvs.cxx b/lotuswordpro/source/filter/utbenvs.cxx
new file mode 100644
index 000000000..f597351ae
--- /dev/null
+++ b/lotuswordpro/source/filter/utbenvs.cxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "first.hxx"
+#include <assert.h>
+namespace OpenStormBento
+{
+/**
+* Value stream read function
+* @param data pointer of bytes read
+* @param number of bytes to be read
+* @return number of bytes read
+*/
+std::size_t LtcUtBenValueStream::GetData(void* pData, std::size_t nSize)
+{
+ size_t AmtRead;
+
+ /*BenError Err = */cpValue->ReadValueData(pData, cCurrentPosition, nSize,
+ &AmtRead);
+ cCurrentPosition += AmtRead;
+
+ return AmtRead;
+}
+ /**
+* Value stream write function, not supported now
+* @param pointer of saved buffer
+* @param size of buffer to be written
+* @return number of bytes written into value stream
+*/
+std::size_t LtcUtBenValueStream::PutData(const void* /*pData*/, std::size_t nSize)
+{
+ /* Because we only support IMPORT filter, PutData implementation is ignored
+ It won't bring negative influence to read-only stream object */
+ assert(false);
+ return nSize;
+}
+/**
+* Seek function of value stream
+* @param position in value stream
+* @return current position in value stream
+*/
+sal_uInt64 LtcUtBenValueStream::SeekPos(sal_uInt64 const nPos)
+{
+ if (nPos <= m_ulValueLength)
+ cCurrentPosition = nPos;
+ else
+ cCurrentPosition = m_ulValueLength;
+ return cCurrentPosition;
+}
+/**
+* Set buffer size function
+* @param size of buffer
+* @return
+*/
+ void LtcUtBenValueStream::SetSize( sal_uInt64 /*nSize*/ )
+{
+ //pLtcBenContainer pContainer = cpValue->GetContainer();
+ //pContainer->GetStream()->SetStreamSize(nSize);
+}
+/**
+* Flush data function, not supported now
+*/
+void LtcUtBenValueStream::FlushData()
+{
+ /* Because we only support IMPORT filter, FlushData implementation is ignored
+ It won't bring negative influence to read-only stream object
+ pLtcBenContainer pContainer = cpValue->GetContainer();
+ pContainer->GetStream()->Flush();*/
+ assert(false);
+}
+/**
+* Construction
+*/
+LtcUtBenValueStream::LtcUtBenValueStream(CBenValue * pValue)
+ : cpValue(pValue),
+ // Calculate the length of the whole value stream
+ cCurrentPosition(0),
+ m_ulValueLength(pValue->GetValueSize())
+{
+}
+
+LtcUtBenValueStream::~LtcUtBenValueStream()
+{
+}
+
+} // end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/utlist.cxx b/lotuswordpro/source/filter/utlist.cxx
new file mode 100644
index 000000000..5c0d4d261
--- /dev/null
+++ b/lotuswordpro/source/filter/utlist.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "first.hxx"
+
+namespace OpenStormBento
+{
+
+CUtListElmt::CUtListElmt(CUtList * pList)
+ : cpNext(nullptr)
+ , cpPrev(nullptr)
+{
+ if (pList != nullptr)
+ InsertAfter(pList->GetLast());
+}
+
+CUtListElmt::~CUtListElmt()
+{
+ if (cpNext != nullptr)
+ {
+ cpPrev->cpNext = cpNext;
+ cpNext->cpPrev = cpPrev;
+ }
+}
+
+CUtList::~CUtList()
+{
+ CUtListElmt& rTerminating = GetTerminating();
+ for (CUtListElmt * pCurr = GetFirst(); pCurr != &rTerminating; )
+ {
+ CUtListElmt * pNext = pCurr->GetNext();
+ pCurr->MakeNotOnList();
+ pCurr = pNext;
+ }
+ rTerminating.SetPrev(&rTerminating);
+ rTerminating.SetNext(&rTerminating);
+}
+
+// If pCurr is NULL, returns first item in list. Otherwise, returns item
+// in list after pCurr or NULL if no more items in list. Terminating item
+// is never returned
+CUtListElmt *
+CUtList::GetNextOrNULL(CUtListElmt const * pCurr)
+{
+ CUtListElmt * pNext;
+
+ if (pCurr == nullptr)
+ pNext = GetFirst();
+ else pNext = pCurr->GetNext();
+ if (pNext == &GetTerminating())
+ pNext = nullptr;
+ return pNext;
+}
+
+void
+CUtList::Destroy()
+{
+ CUtListElmt& rTerminating = GetTerminating();
+ for (CUtListElmt * pCurr = GetFirst(); pCurr != &rTerminating; )
+ {
+ CUtListElmt * pNext = pCurr->GetNext();
+ delete pCurr;
+ pCurr = pNext;
+ }
+}
+
+CUtOwningList::~CUtOwningList()
+{
+ Destroy();
+}
+}//end namespace OpenStormBento
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/utlist.hxx b/lotuswordpro/source/filter/utlist.hxx
new file mode 100644
index 000000000..3528fcacb
--- /dev/null
+++ b/lotuswordpro/source/filter/utlist.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_UTLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_UTLIST_HXX
+
+namespace OpenStormBento
+{
+
+class CUtList;
+
+class CUtListElmt
+{
+public: // Methods
+ CUtListElmt()
+ : cpNext(nullptr)
+ , cpPrev(nullptr)
+ {}
+ explicit CUtListElmt(CUtListElmt * pPrev) { InsertAfter(pPrev); }
+ explicit CUtListElmt(CUtList * pList);
+ virtual ~CUtListElmt();
+ void MakeNotOnList() { cpNext = nullptr; } // Same as Remove but doesn't
+ // patch up list
+ CUtListElmt * GetNext() const { return cpNext; }
+ void SetNext(CUtListElmt * pNext) { cpNext = pNext; }
+ CUtListElmt * GetPrev() const { return cpPrev; }
+ void SetPrev(CUtListElmt * pPrev) { cpPrev = pPrev; }
+ void InsertAfter(CUtListElmt * pPrev)
+ {
+ cpNext = pPrev->cpNext;
+ cpPrev = pPrev;
+ cpNext->cpPrev = this;
+ pPrev->cpNext = this;
+ }
+
+private: // Data
+ CUtListElmt * cpNext;
+ CUtListElmt * cpPrev;
+};
+
+class CUtList
+{
+public: // Methods
+ CUtList() {
+ cDummyElmt.SetNext(&cDummyElmt);
+ cDummyElmt.SetPrev(&cDummyElmt);
+ }
+ virtual ~CUtList();
+ CUtListElmt * GetFirst() { return cDummyElmt.GetNext(); }
+ CUtListElmt * GetLast() { return cDummyElmt.GetPrev(); }
+ CUtListElmt& GetTerminating() { return cDummyElmt; }
+ CUtListElmt * GetNextOrNULL(CUtListElmt const * pCurr);
+
+ void Destroy();
+
+private: // Data
+ CUtListElmt cDummyElmt;
+};
+
+class CUtOwningList : public CUtList
+{
+public: // Methods
+ virtual ~CUtOwningList() override;
+};
+}//end namespace OpenStormBento
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfbase64.cxx b/lotuswordpro/source/filter/xfilter/xfbase64.cxx
new file mode 100644
index 000000000..1b7224a24
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfbase64.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Base64 tool.
+ ************************************************************************/
+#include <string.h>
+#include <memory>
+#include "xfbase64.hxx"
+
+const char aBase64EncodeTable[] =
+{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
+
+/**
+ * @descr Encode 3 byte to 4 byte.
+ * Please refer to RFC to get the base64 algorithm.
+ */
+static void Encode_(const sal_uInt8 *src, char* dest)
+{
+ sal_Int32 nBinaer = (src[ 0] << 16) +
+ (src[1] << 8) +
+ (src[2]);
+
+ sal_uInt8 nIndex = ((nBinaer & 0xFC0000) >> 18);
+ dest[0] = aBase64EncodeTable [nIndex];
+
+ nIndex = (nBinaer & 0x3F000) >> 12;
+ dest[1] =aBase64EncodeTable [nIndex];
+
+ nIndex = (nBinaer & 0xFC0) >> 6;
+ dest[2] = aBase64EncodeTable [nIndex];
+
+ nIndex = (nBinaer & 0x3F);
+ dest[3] = aBase64EncodeTable [nIndex];
+}
+
+/**
+ * @descr Base64 encode.
+ */
+OUString XFBase64::Encode(sal_uInt8 const *buf, sal_Int32 len)
+{
+ std::unique_ptr<char[]> buffer;
+ sal_Int32 nNeeded;
+ sal_Int32 cycles = len/3;
+ sal_Int32 remain = len%3;
+
+ if( remain == 0 )
+ nNeeded = cycles*4;
+ else
+ nNeeded = (cycles+1)*4;
+ buffer.reset(new char[nNeeded+1]);
+
+ memset(buffer.get(), 0, nNeeded+1);
+
+ for( sal_Int32 i=0; i<cycles; i++ )
+ Encode_(buf+i*3,buffer.get()+i*4);
+
+ sal_uInt8 last[3];
+ if( remain == 1 )
+ {
+ last[0] = buf[len-1];
+ last[1] = last[2] = 0;
+ Encode_(last,buffer.get()+nNeeded+1-5);
+ }
+ else if( remain == 2 )
+ {
+ last[0] = buf[len-2];
+ last[1] = buf[len-1];
+ last[2] = 0;
+ Encode_(last,buffer.get()+nNeeded+1-5);
+ }
+
+ OUString str = OUString::createFromAscii(buffer.get());
+ return str;
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfbase64.hxx b/lotuswordpro/source/filter/xfilter/xfbase64.hxx
new file mode 100644
index 000000000..58f790a30
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfbase64.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Base64 tool.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFBASE64_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFBASE64_HXX
+
+#include <rtl/ustring.hxx>
+
+/**
+ * @brief
+ * Base64 algorithm implementation.
+ * I only implements encode function now, i'll add decode if needed later.
+ * http://www.faqs.org/rfcs/rfc3548.html.
+ */
+
+class XFBase64
+{
+public:
+ /**
+ * @descr Encode binary buffer to base64 encoding.
+ */
+ static OUString Encode(sal_uInt8 const* buf, sal_Int32 len);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfbgimage.cxx b/lotuswordpro/source/filter/xfilter/xfbgimage.cxx
new file mode 100644
index 000000000..d4b4e5be6
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfbgimage.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Background image.
+ ************************************************************************/
+#include <xfilter/xfbgimage.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfutil.hxx>
+#include "xfbase64.hxx"
+
+XFBGImage::XFBGImage()
+ : m_bUserFileLink(false)
+ , m_bRepeate(false)
+ , m_bStretch(false)
+ , m_bPosition(true)
+ , m_eHoriAlign(enumXFAlignCenter)
+ , m_eVertAlign(enumXFAlignCenter)
+{}
+
+void XFBGImage::SetImageData(sal_uInt8 const *buf, int len)
+{
+ m_strData = XFBase64::Encode(buf,len);
+ m_bUserFileLink = false;
+}
+
+bool XFBGImage::Equal(IXFStyle * /* pStyle */)
+{
+ return false;
+}
+
+void XFBGImage::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( m_bUserFileLink )
+ {
+ pAttrList->AddAttribute( "xlink:href", m_strFileName);
+ }
+
+ pAttrList->AddAttribute( "xlink:type", "simple" );
+ pAttrList->AddAttribute( "xlink:actuate", "onLoad");
+
+ if( m_bPosition )
+ {
+ OUString str = GetAlignName(m_eVertAlign) + " ";
+ if( m_eHoriAlign == enumXFAlignStart )
+ str += "left";
+ else if( m_eHoriAlign == enumXFAlignCenter )
+ str += "center";
+ else if( m_eHoriAlign == enumXFAlignEnd )
+ str += "right";
+
+ pAttrList->AddAttribute( "style:position", str );
+ pAttrList->AddAttribute( "style:repeat", "no-repeat" );
+ }
+ else if( m_bRepeate )
+ pAttrList->AddAttribute( "style:repeat", "repeat" );
+ else if( m_bStretch )
+ pAttrList->AddAttribute( "style:repeat", "stretch" );
+
+ pStrm->StartElement( "style:background-image" );
+
+ if( !m_bUserFileLink )
+ {
+ pAttrList->Clear();
+ pStrm->StartElement( "office:binary-data" );
+ pStrm->Characters(m_strData);
+ pStrm->EndElement( "office:binary-data" );
+ }
+
+ pStrm->EndElement( "style:background-image" );
+}
+
+bool operator==(XFBGImage const & img1, XFBGImage const & img2)
+{
+ if( img1.m_bUserFileLink != img2.m_bUserFileLink )
+ return false;
+ if( img1.m_bUserFileLink )
+ {
+ if( img1.m_strFileName != img2.m_strFileName )
+ return false;
+ }
+ else
+ {
+ //I'll not compare the content of the two buffer,it's time consuming.
+ return false;
+ }
+ if( img1.m_bPosition != img2.m_bPosition )
+ return false;
+ if( img1.m_bRepeate != img2.m_bRepeate )
+ return false;
+ if( img1.m_bStretch != img2.m_bStretch )
+ return false;
+ if( img1.m_bPosition )
+ {
+ if( (img1.m_eHoriAlign != img2.m_eHoriAlign) || (img1.m_eVertAlign != img2.m_eVertAlign) )
+ return false;
+ }
+ return true;
+}
+
+bool operator!=(XFBGImage const & img1, XFBGImage const & img2)
+{
+ return !(img1==img2);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfborders.cxx b/lotuswordpro/source/filter/xfilter/xfborders.cxx
new file mode 100644
index 000000000..f6027a155
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfborders.cxx
@@ -0,0 +1,366 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Border object,now only used by paragraph object.
+ ************************************************************************/
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFBorder::XFBorder()
+{
+ m_bDouble = false;
+ m_bSameWidth = false;
+ m_fWidthInner = 0;
+ m_fWidthSpace = 0;
+ m_fWidthOuter = 0;
+}
+
+void XFBorder::SetColor(XFColor const & color)
+{
+ m_aColor = color;
+}
+
+void XFBorder::SetWidth(double width)
+{
+ if( !m_bDouble )
+ {
+ m_fWidthInner = width;
+ m_bSameWidth = true;
+ }
+ else if (m_bSameWidth)
+ {
+ m_fWidthInner = width;
+ m_fWidthOuter = width;
+ m_fWidthSpace = width;
+ }
+}
+
+void XFBorder::SetDoubleLine(bool dual,bool bSameWidth)
+{
+ m_bDouble = dual;
+ m_bSameWidth = bSameWidth;
+}
+
+void XFBorder::SetWidthInner(double inner)
+{
+ assert(m_bDouble);
+ m_fWidthInner = inner;
+}
+
+void XFBorder::SetWidthSpace(double space)
+{
+ assert(m_bDouble);
+ m_fWidthSpace = space;
+}
+
+void XFBorder::SetWidthOuter(double outer)
+{
+ assert(m_bDouble);
+ m_fWidthOuter = outer;
+}
+
+OUString XFBorder::GetLineWidth()
+{
+ OUString str;
+
+ if( m_bDouble )
+ {
+ str = OUString::number(m_fWidthInner) + "cm " +
+ OUString::number(m_fWidthSpace) + "cm " +
+ OUString::number(m_fWidthOuter) + "cm";
+ }
+ return str;
+}
+
+OUString XFBorder::ToString()
+{
+ OUString str;
+
+ if( m_bDouble )
+ {
+ double width = m_fWidthInner + m_fWidthSpace + m_fWidthOuter;
+ if( width<FLOAT_MIN )
+ {
+ return str;
+ }
+
+ str = OUString::number(width) + "cm double " + m_aColor.ToString();
+ }
+ else
+ {
+ double width = m_fWidthInner;
+ if( width<FLOAT_MIN )
+ {
+ return str;
+ }
+ str = OUString::number(width) + "cm solid " + m_aColor.ToString();
+ }
+ return str;
+}
+
+bool operator==(XFBorder const & b1, XFBorder const & b2)
+{
+ if( b1.m_bDouble != b2.m_bDouble )
+ return false;
+ if( !b1.m_bDouble )
+ {
+ if( b1.m_fWidthInner != b2.m_fWidthInner )
+ return false;
+ }
+ else
+ {
+ if( b1.m_bSameWidth != b2.m_bSameWidth )
+ return true;
+ if( b1.m_fWidthInner != b2.m_fWidthInner ||
+ b1.m_fWidthSpace != b2.m_fWidthSpace ||
+ b1.m_fWidthOuter != b2.m_fWidthOuter
+ )
+ return false;
+ }
+ if( b1.m_aColor != b2.m_aColor )
+ return false;
+ return true;
+}
+
+bool operator!=(XFBorder const & b1, XFBorder const & b2)
+{
+ return !(b1 == b2);
+}
+
+//XFBorders:
+
+void XFBorders::SetColor(enumXFBorder side, XFColor const & color)
+{
+ switch(side)
+ {
+ case enumXFBorderLeft:
+ m_aBorderLeft.SetColor(color);
+ break;
+ case enumXFBorderRight:
+ m_aBorderRight.SetColor(color);
+ break;
+ case enumXFBorderTop:
+ m_aBorderTop.SetColor(color);
+ break;
+ case enumXFBorderBottom:
+ m_aBorderBottom.SetColor(color);
+ break;
+ default:
+ break;
+ }
+}
+
+void XFBorders::SetWidth(enumXFBorder side, double width)
+{
+ switch(side)
+ {
+ case enumXFBorderLeft:
+ m_aBorderLeft.SetWidth(width);
+ break;
+ case enumXFBorderRight:
+ m_aBorderRight.SetWidth(width);
+ break;
+ case enumXFBorderTop:
+ m_aBorderTop.SetWidth(width);
+ break;
+ case enumXFBorderBottom:
+ m_aBorderBottom.SetWidth(width);
+ break;
+ default:
+ break;
+ }
+}
+
+void XFBorders::SetDoubleLine(enumXFBorder side)
+{
+ switch(side)
+ {
+ case enumXFBorderLeft:
+ m_aBorderLeft.SetDoubleLine(true/*dual*/,false/*bSameWidth*/);
+ break;
+ case enumXFBorderRight:
+ m_aBorderRight.SetDoubleLine(true/*dual*/,false/*bSameWidth*/);
+ break;
+ case enumXFBorderTop:
+ m_aBorderTop.SetDoubleLine(true/*dual*/,false/*bSameWidth*/);
+ break;
+ case enumXFBorderBottom:
+ m_aBorderBottom.SetDoubleLine(true/*dual*/,false/*bSameWidth*/);
+ break;
+ default:
+ break;
+ }
+}
+
+void XFBorders::SetWidthInner(enumXFBorder side, double inner)
+{
+ switch(side)
+ {
+ case enumXFBorderLeft:
+ m_aBorderLeft.SetWidthInner(inner);
+ break;
+ case enumXFBorderRight:
+ m_aBorderRight.SetWidthInner(inner);
+ break;
+ case enumXFBorderTop:
+ m_aBorderTop.SetWidthInner(inner);
+ break;
+ case enumXFBorderBottom:
+ m_aBorderBottom.SetWidthInner(inner);
+ break;
+ default:
+ break;
+ }
+}
+
+void XFBorders::SetWidthSpace(enumXFBorder side, double space)
+{
+ switch(side)
+ {
+ case enumXFBorderLeft:
+ m_aBorderLeft.SetWidthSpace(space);
+ break;
+ case enumXFBorderRight:
+ m_aBorderRight.SetWidthSpace(space);
+ break;
+ case enumXFBorderTop:
+ m_aBorderTop.SetWidthSpace(space);
+ break;
+ case enumXFBorderBottom:
+ m_aBorderBottom.SetWidthSpace(space);
+ break;
+ default:
+ break;
+ }
+}
+
+void XFBorders::SetWidthOuter(enumXFBorder side, double outer)
+{
+ switch(side)
+ {
+ case enumXFBorderLeft:
+ m_aBorderLeft.SetWidthOuter(outer);
+ break;
+ case enumXFBorderRight:
+ m_aBorderRight.SetWidthOuter(outer);
+ break;
+ case enumXFBorderTop:
+ m_aBorderTop.SetWidthOuter(outer);
+ break;
+ case enumXFBorderBottom:
+ m_aBorderBottom.SetWidthOuter(outer);
+ break;
+ default:
+ break;
+ }
+}
+
+bool operator ==(XFBorders const & b1, XFBorders const & b2)
+{
+ if( b1.m_aBorderLeft != b2.m_aBorderLeft )
+ return false;
+ if( b1.m_aBorderRight != b2.m_aBorderRight )
+ return false;
+ if( b1.m_aBorderTop != b2.m_aBorderTop )
+ return false;
+ if( b1.m_aBorderBottom != b2.m_aBorderBottom )
+ return false;
+ return true;
+}
+
+bool operator!=(XFBorders const & b1, XFBorders const & b2)
+{
+ return !(b1 == b2);
+}
+
+void XFBorders::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !m_aBorderLeft.GetLineWidth().isEmpty() )
+ pAttrList->AddAttribute( "style:border-line-width-left", m_aBorderLeft.GetLineWidth() );
+ if( !m_aBorderRight.GetLineWidth().isEmpty() )
+ pAttrList->AddAttribute( "style:border-line-width-right", m_aBorderRight.GetLineWidth() );
+ if( !m_aBorderTop.GetLineWidth().isEmpty() )
+ pAttrList->AddAttribute( "style:border-line-width-top", m_aBorderTop.GetLineWidth() );
+ if( !m_aBorderBottom.GetLineWidth().isEmpty() )
+ pAttrList->AddAttribute( "style:border-line-width-bottom", m_aBorderBottom.GetLineWidth() );
+
+ if( !m_aBorderLeft.ToString().isEmpty() )
+ pAttrList->AddAttribute( "fo:border-left", m_aBorderLeft.ToString() );
+ else
+ pAttrList->AddAttribute( "fo:border-left", "none" );
+
+ if( !m_aBorderRight.ToString().isEmpty() )
+ pAttrList->AddAttribute( "fo:border-right", m_aBorderRight.ToString() );
+ else
+ pAttrList->AddAttribute( "fo:border-right", "none" );
+
+ if( !m_aBorderTop.ToString().isEmpty() )
+ pAttrList->AddAttribute( "fo:border-top", m_aBorderTop.ToString() );
+ else
+ pAttrList->AddAttribute( "fo:border-top", "none" );
+
+ if( !m_aBorderBottom.ToString().isEmpty() )
+ pAttrList->AddAttribute( "fo:border-bottom", m_aBorderBottom.ToString() );
+ else
+ pAttrList->AddAttribute( "fo:border-bottom", "none" );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx
new file mode 100644
index 000000000..bbfde6eab
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table cell.
+ ************************************************************************/
+#include <xfilter/xfcell.hxx>
+
+#include <stdexcept>
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xftable.hxx>
+#include <xfilter/xfrow.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFCell::XFCell()
+ : m_pOwnerRow(nullptr)
+ , m_nCol(0)
+ , m_nColSpaned(1)
+ , m_nRepeated(0)
+ , m_eValueType(enumXFValueTypeNone)
+ , m_bProtect(false)
+{}
+
+XFCell::~XFCell()
+{
+}
+
+void XFCell::Add(XFContent *pContent)
+{
+ if( m_eValueType != enumXFValueTypeNone )
+ {
+ Reset();
+ m_eValueType = enumXFValueTypeNone;
+ }
+ if (m_pSubTable.is())
+ {
+ throw std::runtime_error("subtable already set");
+ }
+ if (!pContent)
+ {
+ throw std::runtime_error("no content");
+ }
+ if( pContent->GetContentType() == enumXFContentTable )
+ {
+ XFTable *pTable = dynamic_cast<XFTable*>(pContent);
+ if( !pTable )
+ return;
+ //the sub table will fill all the cell, there can't be other contents.
+ pTable->SetOwnerCell(this);
+ m_pSubTable = pTable;
+ }
+ else if( pContent->GetContentType() == enumXFContentText )
+ {
+ XFParagraph *pPara = new XFParagraph();
+ pPara->Add(pContent);
+ XFContentContainer::Add(pPara);
+ }
+ else if( pContent->GetContentType() == enumXFContentFrame )
+ {
+ XFParagraph *pPara = new XFParagraph();
+ pPara->Add(pContent);
+ XFContentContainer::Add(pPara);
+ }
+ else
+ {
+ XFContentContainer::Add(pContent);
+ }
+}
+
+void XFCell::SetValue(double value)
+{
+ SetValue(OUString::number(value));
+}
+
+void XFCell::SetValue(const OUString& value)
+{
+ m_eValueType = enumXFValueTypeFloat;
+ m_strValue = value;
+}
+
+OUString XFCell::GetCellName()
+{
+ XFRow *pRow = m_pOwnerRow;
+
+ if( !pRow )
+ return OUString();
+
+ XFTable *pTable = pRow->GetOwnerTable();
+
+ if( !pTable )
+ return OUString();
+
+ OUString name;
+ if( pTable->IsSubTable() )
+ {
+ name = pTable->GetTableName() + "." + OUString::number(m_nCol) + "." + OUString::number(pRow->GetRow());
+ }
+ else
+ {
+ name = GetTableColName(m_nCol) + OUString::number(pRow->GetRow());
+ }
+ return name;
+}
+
+void XFCell::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "table:style-name", GetStyleName() );
+ if( m_nColSpaned>1 )
+ pAttrList->AddAttribute( "table:number-columns-spanned", OUString::number(m_nColSpaned) );
+ if( m_nRepeated )
+ pAttrList->AddAttribute( "table:number-columns-repeated", OUString::number(m_nRepeated) );
+ if( m_eValueType != enumXFValueTypeNone )
+ {
+ pAttrList->AddAttribute( "table:value-type", GetValueType(m_eValueType) );
+ pAttrList->AddAttribute( "table:value", m_strValue );
+ }
+ if( !m_strFormula.isEmpty() )
+ pAttrList->AddAttribute( "table:formula", m_strFormula );
+
+ if( m_bProtect )
+ pAttrList->AddAttribute( "table:protected", "true" );
+
+ //for test only.
+// pAttrList->AddAttribute( "table:cell-name", GetCellName() );
+
+ pStrm->StartElement( "table:table-cell" );
+
+ if( m_pSubTable.is() )
+ m_pSubTable->ToXml(pStrm);
+ else
+ {
+ XFContentContainer::ToXml(pStrm);
+ }
+
+ pStrm->EndElement( "table:table-cell" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx b/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx
new file mode 100644
index 000000000..e615778a9
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx
@@ -0,0 +1,245 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table cell style. Number format, string value, and so on...
+ ************************************************************************/
+#include <xfilter/xfcellstyle.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xfbgimage.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFCellStyle::XFCellStyle()
+ : m_eHoriAlign(enumXFAlignNone)
+ , m_eVertAlign(enumXFAlignNone)
+{}
+
+XFCellStyle::~XFCellStyle()
+{
+}
+
+void XFCellStyle::SetPadding(double left, double right,double top, double bottom)
+{
+ if( left != -1 )
+ m_aPadding.SetLeft(left);
+ if( right != -1 )
+ m_aPadding.SetRight(right);
+ if( top != -1 )
+ m_aPadding.SetTop(top);
+ if( bottom != -1 )
+ m_aPadding.SetBottom( bottom );
+}
+
+void XFCellStyle::SetBackColor(XFColor const & color)
+{
+ m_aBackColor = color;
+}
+
+void XFCellStyle::SetBackImage(std::unique_ptr<XFBGImage>& rImage)
+{
+ m_xBackImage = std::move(rImage);
+}
+
+void XFCellStyle::SetBorders(XFBorders *pBorders)
+{
+ m_pBorders.reset( pBorders );
+}
+
+enumXFStyle XFCellStyle::GetStyleFamily()
+{
+ return enumXFStyleTableCell;
+}
+
+/**
+ *Affirm whether two XFCellStyle objects are equal.
+ */
+bool XFCellStyle::Equal(IXFStyle *pStyle)
+{
+ if( this == pStyle )
+ return true;
+ if( !pStyle || pStyle->GetStyleFamily() != enumXFStyleTableCell )
+ return false;
+
+ XFCellStyle *pOther = dynamic_cast<XFCellStyle*>(pStyle);
+ if( !pOther )
+ return false;
+
+ if( m_strDataStyle != pOther->m_strDataStyle )
+ return false;
+
+ if( m_strParentStyleName != pOther->m_strParentStyleName )
+ return false;
+
+ //align:
+ if( m_eHoriAlign != pOther->m_eHoriAlign )
+ return false;
+ if( m_eVertAlign != pOther->m_eVertAlign )
+ return false;
+
+ if( m_aBackColor != pOther->m_aBackColor )
+ return false;
+ //shadow:
+ if( m_aShadow != pOther->m_aShadow )
+ return false;
+ //margin:
+ if( m_aMargin != pOther->m_aMargin )
+ return false;
+ //padding:
+ if( m_aPadding != pOther->m_aPadding )
+ return false;
+
+ //font:
+ if( m_pFont.is() )
+ {
+ if( !pOther->m_pFont.is() )
+ return false;
+ if(*m_pFont != *pOther->m_pFont )
+ return false;
+ }
+ else if( pOther->m_pFont.is() )
+ return false;
+
+ //border:
+ if( m_pBorders )
+ {
+ if( !pOther->m_pBorders )
+ return false;
+ if( *m_pBorders != *pOther->m_pBorders )
+ return false;
+ }
+ else if( pOther->m_pBorders )
+ return false;
+
+ //if there is backimage
+ if (m_xBackImage)
+ {
+ if( !pOther->m_xBackImage )
+ return false;
+ if( !m_xBackImage->Equal(pOther) )
+ return false;
+ }
+ else
+ {
+ if( pOther->m_xBackImage )
+ return false;
+ }
+
+ return true;
+}
+
+void XFCellStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ OUString style = GetStyleName();
+
+ pAttrList->Clear();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute("style:name",GetStyleName());
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+
+ pAttrList->AddAttribute("style:family", "table-cell");
+ if( !m_strParentStyleName.isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",m_strParentStyleName);
+ if( !m_strDataStyle.isEmpty() )
+ pAttrList->AddAttribute( "style:data-style-name", m_strDataStyle );
+
+ pStrm->StartElement("style:style");
+
+ //Paragraph properties:
+ pAttrList->Clear();
+
+ //padding:
+ m_aPadding.ToXml(pStrm);
+ //margin:
+ m_aMargin.ToXml(pStrm);
+
+ //text horizontal align:
+ if( m_eHoriAlign != enumXFAlignNone )
+ {
+ pAttrList->AddAttribute("fo:text-align", GetAlignName(m_eHoriAlign) );
+ }
+ //text vertical align
+ if( m_eVertAlign != enumXFAlignNone )
+ pAttrList->AddAttribute( "fo:vertical-align", GetAlignName(m_eVertAlign) );
+
+ //shadow:
+ m_aShadow.ToXml(pStrm);
+ //borders:
+ if( m_pBorders )
+ m_pBorders->ToXml(pStrm);
+
+ //background color:
+ if( m_aBackColor.IsValid() && !m_xBackImage )
+ {
+ pAttrList->AddAttribute("fo:background-color", m_aBackColor.ToString() );
+ }
+ //Font properties:
+ if( m_pFont.is() )
+ m_pFont->ToXml(pStrm);
+
+ pStrm->StartElement("style:properties");
+
+ if( m_xBackImage )
+ m_xBackImage->ToXml(pStrm);
+
+ pStrm->EndElement("style:properties");
+
+ pStrm->EndElement("style:style");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfchange.cxx b/lotuswordpro/source/filter/xfilter/xfchange.cxx
new file mode 100644
index 000000000..0beef2120
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfchange.cxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * For LWP filter architecture prototype
+ ************************************************************************/
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfchange.hxx>
+
+void XFChangeList::ToXml(IXFStream *pStrm)
+{
+ if (XFContentContainer::GetCount() == 0)
+ return;
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ // Add for disable change tracking
+ pAttrList->AddAttribute( "text:track-changes","false");
+ pStrm->StartElement( "text:tracked-changes" );
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement("text:tracked-changes");
+}
+
+void XFChangeRegion::ToXml(IXFStream * /*pStrm*/)
+{
+}
+
+void XFChangeInsert::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if(m_sID.isEmpty())
+ return;
+ pAttrList->AddAttribute( "text:id",m_sID);
+
+ pStrm->StartElement( "text:changed-region" );
+ pStrm->StartElement( "text:insertion" );
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "office:chg-author",m_sEditor);
+ pAttrList->AddAttribute( "office:chg-date-time","0000-00-00T00:00:00");
+ pStrm->StartElement( "office:change-info" );
+ pStrm->EndElement( "office:change-info" );
+ pStrm->EndElement( "text:insertion" );
+ pStrm->EndElement( "text:changed-region" );
+}
+
+void XFChangeDelete::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if(m_sID.isEmpty())
+ return;
+ pAttrList->AddAttribute( "text:id",m_sID);
+
+ pStrm->StartElement( "text:changed-region" );
+ pStrm->StartElement( "text:deletion" );
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "office:chg-author",m_sEditor);
+ pAttrList->AddAttribute( "office:chg-date-time","0000-00-00T00:00:00");
+ pStrm->StartElement( "office:change-info" );
+ pStrm->EndElement( "office:change-info" );
+
+ pStrm->EndElement( "text:deletion" );
+ pStrm->EndElement( "text:changed-region" );
+}
+
+void XFChangeStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if(m_sID.isEmpty())
+ return;
+ pAttrList->AddAttribute( "text:change-id",m_sID);
+
+ pStrm->StartElement( "text:change-start" );
+ pStrm->EndElement( "text:change-start" );
+}
+
+void XFChangeEnd::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if(m_sID.isEmpty())
+ return;
+ pAttrList->AddAttribute( "text:change-id",m_sID);
+
+ pStrm->StartElement( "text:change-end" );
+ pStrm->EndElement( "text:change-end" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcolor.cxx b/lotuswordpro/source/filter/xfilter/xfcolor.cxx
new file mode 100644
index 000000000..357e659fb
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcolor.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Color object to serial to xml filter.
+ ************************************************************************/
+#include <string.h>
+#include <stdio.h>
+#include <xfilter/xfcolor.hxx>
+
+OUString XFColor::ToString() const
+{
+ char buf[8] = {};
+ sprintf(buf,"#%2x%2x%2x",m_nRed, m_nGreen, m_nBlue);
+ for( int i=1; i<7;i++ )
+ {
+ if( buf[i] == ' ' )
+ buf[i] = '0';
+ }
+ return OUString::createFromAscii(buf);
+}
+
+bool operator==(XFColor const & c1, XFColor const & c2)
+{
+ return (
+ (c1.m_nRed==c2.m_nRed)&&
+ (c1.m_nGreen==c2.m_nGreen)&&
+ (c1.m_nBlue==c2.m_nBlue)
+ );
+}
+
+bool operator!=(XFColor const & c1, XFColor const & c2)
+{
+ return !(c1==c2);
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcolstyle.cxx b/lotuswordpro/source/filter/xfilter/xfcolstyle.cxx
new file mode 100644
index 000000000..c0d96851e
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcolstyle.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Column style object.
+ ************************************************************************/
+#include <xfilter/xfcolstyle.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFColStyle::XFColStyle()
+{
+ m_fWidth = 0;
+}
+
+XFColStyle::~XFColStyle()
+{
+}
+
+enumXFStyle XFColStyle::GetStyleFamily()
+{
+ return enumXFStyleTableCol;
+}
+
+void XFColStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ pAttrList->AddAttribute( "style:family", "table-column" );
+ pStrm->StartElement( "style:style" );
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:column-width", OUString::number(m_fWidth) + "cm" );
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcolumns.cxx b/lotuswordpro/source/filter/xfilter/xfcolumns.cxx
new file mode 100644
index 000000000..b5f427d88
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcolumns.cxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Columns styles for section, or paragraph.
+ ************************************************************************/
+#include <xfilter/xfcolumns.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+void XFColumn::SetRelWidth(sal_Int32 width)
+{
+ m_nRelWidth = width;
+}
+
+void XFColumn::SetMargins(double left, double right)
+{
+ m_fMarginLeft = left;
+ m_fMarginRight = right;
+}
+
+void XFColumn::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:rel-width", OUString::number(m_nRelWidth) + "*" );
+ pAttrList->AddAttribute( "fo:margin-left", OUString::number(m_fMarginLeft) + "cm" );
+ pAttrList->AddAttribute( "fo:margin-right", OUString::number(m_fMarginRight) + "cm" );
+
+ pStrm->StartElement( "style:column" );
+ pStrm->EndElement( "style:column" );
+}
+
+void XFColumnSep::SetRelHeight(sal_Int32 height)
+{
+ assert(height>=0&&height<=100);
+ m_nRelHeight = height;
+}
+void XFColumnSep::SetWidth(double width)
+{
+ m_fWidth = width;
+}
+void XFColumnSep::SetColor(XFColor const & color)
+{
+ m_aColor = color;
+}
+void XFColumnSep::SetVerticalAlign(enumXFAlignType align)
+{
+ m_eVertAlign = align;
+}
+
+void XFColumnSep::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:width", OUString::number(m_fWidth) + "cm" );
+ if( m_aColor.IsValid() )
+ pAttrList->AddAttribute( "style:color", m_aColor.ToString() );
+ pAttrList->AddAttribute( "style:height", OUString::number(m_nRelHeight) + "%" );
+ //text align:
+ if( m_eVertAlign == enumXFAlignTop )
+ {
+ pAttrList->AddAttribute("style:vertical-align","top");
+ }
+ else if( m_eVertAlign == enumXFAlignMiddle )
+ {
+ pAttrList->AddAttribute("style:vertical-align","middle");
+ }
+ else if( m_eVertAlign == enumXFAlignBottom )
+ {
+ pAttrList->AddAttribute("style:vertical-align","bottom");
+ }
+
+ pStrm->StartElement( "style:column-sep" );
+ pStrm->EndElement( "style:column-sep" );
+}
+
+void XFColumns::SetSeparator(XFColumnSep const & aSeparator)
+{
+ m_aSeparator = aSeparator;
+ m_nFlag |= XFCOLUMNS_FLAG_SEPARATOR;
+}
+
+void XFColumns::AddColumn(XFColumn const & column)
+{
+ m_aColumns.push_back(column);
+}
+
+void XFColumns::SetGap(double fGap)
+{
+ m_fGap = fGap;
+ m_nFlag |= XFCOLUMNS_FLAG_GAP;
+}
+
+void XFColumns::SetCount(sal_uInt16 nCount)
+{
+ m_nCount = nCount;
+}
+
+void XFColumns::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "fo:column-count", OUString::number(m_nCount));
+ if( m_nFlag&XFCOLUMNS_FLAG_GAP )
+ {
+ pAttrList->AddAttribute( "fo:column-gap", OUString::number(m_fGap)+"cm" );
+ }
+
+ pStrm->StartElement( "style:columns" );
+
+ if( m_nFlag&XFCOLUMNS_FLAG_SEPARATOR ) //column-sep:
+ {
+ m_aSeparator.ToXml(pStrm);
+ }
+
+ if(!(m_nFlag&XFCOLUMNS_FLAG_GAP) )
+ {
+ for (auto & column : m_aColumns)
+ {
+ column.ToXml(pStrm);
+ }
+ }
+ pStrm->EndElement( "style:columns" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
new file mode 100644
index 000000000..343ec4275
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Manager for all config object,include line number config.
+ ************************************************************************/
+#include <xfilter/xfconfigmanager.hxx>
+
+XFConfigManager::XFConfigManager()
+{
+}
+
+XFConfigManager::~XFConfigManager()
+{
+}
+
+void XFConfigManager::SetLineNumberConfig(XFLineNumberConfig *pLNConfig)
+{
+ m_pLineNumberConfig.reset( pLNConfig );
+}
+
+void XFConfigManager::SetFootnoteConfig(XFFootnoteConfig *pFNConfig)
+{
+ m_pFootnoteConfig.reset( pFNConfig );
+}
+
+void XFConfigManager::SetEndnoteConfig(XFEndnoteConfig *pENConfig)
+{
+ m_pEndnoteConfig.reset( pENConfig );
+}
+
+void XFConfigManager::ToXml(IXFStream *pStrm)
+{
+ if( m_pLineNumberConfig )
+ AddStyle(std::move(m_pLineNumberConfig));
+ if( m_pFootnoteConfig )
+ AddStyle(std::move(m_pFootnoteConfig));
+ if( m_pEndnoteConfig )
+ AddStyle(std::move(m_pEndnoteConfig));
+
+ XFStyleContainer::ToXml(pStrm);
+ XFStyleContainer::Reset();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
new file mode 100644
index 000000000..b64ad7272
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Container for content.It will destroy all children when destroy.
+ ************************************************************************/
+#include <xfilter/xfcontentcontainer.hxx>
+#include <xfilter/xftextcontent.hxx>
+
+XFContentContainer::XFContentContainer()
+{
+}
+
+XFContentContainer::~XFContentContainer()
+{
+}
+
+void XFContentContainer::Add(XFContent *pContent)
+{
+ m_aContents.emplace_back(pContent);
+}
+
+void XFContentContainer::Add(const OUString& text)
+{
+ rtl::Reference<XFTextContent> xTC(new XFTextContent);
+ xTC->SetText(text);
+ Add(xTC.get());
+}
+
+int XFContentContainer::GetCount() const
+{
+ return m_aContents.size();
+}
+
+void XFContentContainer::Reset()
+{
+ m_aContents.clear();
+}
+
+rtl::Reference<XFContent> XFContentContainer::FindFirstContent(enumXFContent type)
+{
+ rtl::Reference<XFContent> pRet;
+ rtl::Reference<XFContent> pContent;
+
+ for( int i=0; i<GetCount(); i++ )
+ {
+ pContent = GetContent(i);
+ if( !pContent.is() )
+ continue;
+
+ enumXFContent eType = pContent->GetContentType();
+ if( eType == type )
+ return pContent;
+ else
+ {
+ XFContentContainer *pChildCont = static_cast<XFContentContainer*>(pContent.get());
+ if( pChildCont )
+ {
+ pRet = pChildCont->FindFirstContent(type);
+ if( pRet.is() )
+ return pRet;
+ }
+ }
+ }
+ return pRet;
+}
+
+enumXFContent XFContentContainer::GetContentType()
+{
+ return enumXFContentContainer;
+}
+
+void XFContentContainer::ToXml(IXFStream *pStrm)
+{
+ for (auto const& content : m_aContents)
+ {
+ XFContent *pContent = content.get();
+ if( pContent )
+ pContent->DoToXml(pStrm);
+ }
+}
+
+rtl::Reference<XFContent> XFContentContainer::GetLastContent()
+{
+ // TODO JNA : if m_aContents size is 0, there's some pb
+ sal_uInt32 index = m_aContents.size()-1;
+ if(index >0)
+ {
+ return m_aContents[index];
+ }
+
+ return nullptr;
+}
+
+void XFContentContainer::RemoveLastContent()
+{
+ sal_uInt32 index = m_aContents.size()-1;
+ if(index >0)
+ {
+ m_aContents.erase(m_aContents.begin() + index);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfcrossref.cxx b/lotuswordpro/source/filter/xfilter/xfcrossref.cxx
new file mode 100644
index 000000000..dfd065a61
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfcrossref.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * index entry object.
+ ************************************************************************/
+
+#include <sal/config.h>
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfcrossref.hxx>
+
+XFCrossRefStart::XFCrossRefStart()
+ : m_nType(CROSSREF_INVALID)
+{
+}
+
+XFCrossRefStart::~XFCrossRefStart()
+{
+}
+
+void XFCrossRefStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( m_nType == CROSSREF_TEXT)
+ {
+ pAttrList->AddAttribute( "text:reference-format","text" );
+ }
+ else if( m_nType == CROSSREF_PAGE )
+ {
+ pAttrList->AddAttribute( "text:reference-format", "page" );
+ }
+ else if( m_nType == CROSSREF_PARANUMBER )
+ {
+ pAttrList->AddAttribute( "text:reference-format", "chapter" );
+ }
+ pAttrList->AddAttribute( "text:ref-name", m_strMarkName);
+ pStrm->StartElement( "text:bookmark-ref" );
+}
+
+XFCrossRefEnd::XFCrossRefEnd()
+{
+}
+
+XFCrossRefEnd::~XFCrossRefEnd()
+{
+}
+
+void XFCrossRefEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:bookmark-ref" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdate.cxx b/lotuswordpro/source/filter/xfilter/xfdate.cxx
new file mode 100644
index 000000000..615f85122
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdate.cxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Date field with date style.
+ ************************************************************************/
+#include <string.h>
+#include <xfilter/xfdate.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFDate::XFDate()
+{
+}
+
+XFDate::~XFDate()
+{
+}
+
+void XFDate::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "style:data-style-name", GetStyleName() );
+
+ pStrm->StartElement( "text:date" );
+ if (!m_strText.isEmpty())
+ pStrm->Characters(m_strText);
+ pStrm->EndElement( "text:date" );
+}
+
+void XFDateStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "style:data-style-name", GetStyleName() );
+/* if (m_bValued)
+ pAttrList->AddAttribute( "text:date-value", DateTimeToOUString(m_aDateTime) );
+ if( m_bFixed )
+ pAttrList->AddAttribute( "text:fixed", "true" );
+
+ pStrm->StartElement( "text:date" );
+ if (m_strText.getLength()>0)
+ pStrm->Characters(m_strText);
+*/
+ pStrm->StartElement( "text:date" );
+}
+
+void XFDateEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:date" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdatestyle.cxx b/lotuswordpro/source/filter/xfilter/xfdatestyle.cxx
new file mode 100644
index 000000000..77eeb6aca
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdatestyle.cxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Date style. The date format for date field.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfdatestyle.hxx>
+
+XFDatePart::XFDatePart()
+{
+ m_bTexture = false;
+}
+
+void XFDatePart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ switch(m_ePart)
+ {
+ case enumXFDateUnknown:
+ break;
+ case enumXFDateYear:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:year" );
+ pStrm->EndElement( "number:year" );
+ break;
+ case enumXFDateMonth:
+ pAttrList->Clear();
+ if( m_bTexture )
+ pAttrList->AddAttribute( "number:textual", "true" );
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:month" );
+ pStrm->EndElement( "number:month" );
+ break;
+ case enumXFDateMonthDay:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:day" );
+ pStrm->EndElement( "number:day" );
+ break;
+ case enumXFDateWeekDay:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:day-of-week" );
+ pStrm->EndElement( "number:day-of-week" );
+ break;
+ case enumXFDateYearWeek:
+ pAttrList->Clear();
+ pStrm->StartElement( "number:week-of-year" );
+ pStrm->EndElement( "number:week-of-year" );
+ break;
+ case enumXFDateEra:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:era" );
+ pStrm->EndElement( "number:era" );
+ break;
+ case enumXFDateQuarter:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:quarter" );
+ pStrm->EndElement( "number:quarter" );
+ break;
+ case enumXFDateHour:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:hours" );
+ pStrm->EndElement( "number:hours" );
+ break;
+ case enumXFDateMinute:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:minutes" );
+ pStrm->EndElement( "number:minutes" );
+ break;
+ case enumXFDateSecond:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ if( m_nDecimalPos )
+ pAttrList->AddAttribute( "number:decimal-places", OUString::number(m_nDecimalPos) );
+ pStrm->StartElement( "number:seconds" );
+ pStrm->EndElement( "number:seconds" );
+ break;
+ case enumXFDateAmPm:
+ pStrm->StartElement( "number:am-pm" );
+ pStrm->EndElement( "number:am-pm" );
+ break;
+ case enumXFDateText:
+ pAttrList->Clear();
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters( m_strText );
+ pStrm->EndElement( "number:text" );
+ break;
+ }
+}
+
+XFDateStyle::XFDateStyle()
+{
+}
+
+XFDateStyle::~XFDateStyle()
+{
+}
+
+enumXFStyle XFDateStyle::GetStyleFamily()
+{
+ return enumXFStyleDate;
+}
+
+void XFDateStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ pAttrList->AddAttribute( "style:family", "data-style" );
+
+ pStrm->StartElement( "number:date-style" );
+
+ m_aParts.ToXml(pStrm);
+
+ pStrm->EndElement( "number:date-style" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdocfield.cxx b/lotuswordpro/source/filter/xfilter/xfdocfield.cxx
new file mode 100644
index 000000000..da32ed829
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdocfield.cxx
@@ -0,0 +1,234 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * doc field.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfdocfield.hxx>
+
+void XFFileName::SetType(const OUString& sType)
+{
+ m_strType = sType;
+}
+
+void XFFileName::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (m_strType == "FileName")
+ pAttrList->AddAttribute( "text:display", "name-and-extension" );
+ else if (m_strType == "Path")
+ pAttrList->AddAttribute( "text:display", "path" );
+ pStrm->StartElement( "text:file-name" );
+ pStrm->EndElement( "text:file-name" );
+}
+
+void XFWordCount::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:word-count" );
+ pStrm->EndElement( "text:word-count" );
+}
+
+void XFCharCount::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:character-count" );
+ pStrm->EndElement( "text:character-count" );
+}
+
+void XFDescription::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:description" );
+ pStrm->EndElement( "text:description" );
+}
+
+void XFPageCountStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:page-count" );
+}
+void XFPageCountEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:page-count" );
+}
+
+void XFWordCountStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:word-count" );
+}
+
+void XFCharCountStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:character-count" );
+}
+
+void XFDescriptionStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:description" );
+}
+
+void XFWordCountEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:word-count" );
+}
+
+void XFCharCountEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:character-count" );
+}
+
+void XFDescriptionEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:description" );
+}
+
+void XFKeywords::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:keywords" );
+ pStrm->EndElement( "text:keywords" );
+}
+
+void XFTotalEditTime::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (!m_strStyleName.isEmpty())
+ pAttrList->AddAttribute( "style:data-style-name", m_strStyleName );
+ pStrm->StartElement( "text:editing-duration" );
+ pStrm->EndElement( "text:editing-duration" );
+}
+void XFTotalEditTimeStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (!m_strStyleName.isEmpty())
+ pAttrList->AddAttribute( "style:data-style-name", m_strStyleName );
+ pStrm->StartElement( "text:editing-duration" );
+}
+void XFTotalEditTimeEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:editing-duration" );
+}
+void XFCreateTime::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (!m_strStyleName.isEmpty())
+ pAttrList->AddAttribute( "style:data-style-name", m_strStyleName );
+ pStrm->StartElement( "text:creation-time" );
+ pStrm->EndElement( "text:creation-time" );
+}
+void XFLastEditTime::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (!m_strStyleName.isEmpty())
+ pAttrList->AddAttribute( "style:data-style-name", m_strStyleName );
+ pStrm->StartElement( "text:modification-time" );
+ pStrm->EndElement( "text:modification-time" );
+}
+
+void XFCreateTimeStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (!m_strStyleName.isEmpty())
+ pAttrList->AddAttribute( "style:data-style-name", m_strStyleName );
+ pStrm->StartElement( "text:creation-time" );
+}
+
+void XFLastEditTimeStart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ if (!m_strStyleName.isEmpty())
+ pAttrList->AddAttribute( "style:data-style-name", m_strStyleName );
+ pStrm->StartElement( "text:modification-time" );
+}
+void XFCreateTimeEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:creation-time" );
+}
+
+void XFLastEditTimeEnd::ToXml(IXFStream *pStrm)
+{
+ pStrm->EndElement( "text:modification-time" );
+}
+
+void XFInitialCreator::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pStrm->StartElement( "text:initial-creator" );
+ pStrm->EndElement( "text:initial-creator" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx
new file mode 100644
index 000000000..045054399
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Area style of Drawing object.
+ ************************************************************************/
+#include "xfdrawareastyle.hxx"
+#include <xfilter/ixfattrlist.hxx>
+
+XFDrawAreaStyle::XFDrawAreaStyle()
+ : m_eAreaStyle(enumXFAreaSolid)
+ , m_eLineStyle(enumXFAreaLineSingle)
+ , m_nAngle(0)
+ , m_fSpace(0.18)
+{}
+
+enumXFStyle XFDrawAreaStyle::GetStyleFamily()
+{
+ return enumXFStyleArea;
+}
+
+void XFDrawAreaStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "draw:name", GetStyleName() );
+
+ if( m_eLineStyle == enumXFAreaLineSingle )
+ pAttrList->AddAttribute( "draw:style", "single" );
+ else if( m_eLineStyle == enumXFAreaLineCrossed )
+ pAttrList->AddAttribute( "draw:style", "double" );
+ else if( m_eLineStyle == enumXFAreaLineTriple )
+ pAttrList->AddAttribute( "draw:style", "triple" );
+
+ pAttrList->AddAttribute( "draw:color", m_aLineColor.ToString() );
+ pAttrList->AddAttribute( "draw:rotation", OUString::number(m_nAngle*10) );
+ pAttrList->AddAttribute( "draw:distance", OUString::number(m_fSpace)+"cm" );
+
+ pStrm->StartElement( "draw:hatch" );
+ pStrm->EndElement( "draw:hatch" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx
new file mode 100644
index 000000000..6775b049c
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Area style of Drawing object.
+ * Only support fill color and fill pattern now.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFDRAWAREASTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFDRAWAREASTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+#include <xfilter/xfcolor.hxx>
+
+class XFDrawAreaStyle : public XFStyle
+{
+public:
+ XFDrawAreaStyle();
+
+public:
+ void SetAreaStyle(enumXFAreaStyle style);
+
+ void SetLineStyle(enumXFAreaLineStyle style);
+
+ void SetBackColor(XFColor const & color);
+
+ void SetLineColor(XFColor const & color);
+
+ void SetLineAngle(sal_Int32 angle);
+
+ void SetLineSpace(double space);
+
+ enumXFAreaStyle GetAreaStyle() const;
+
+ const XFColor& GetBackColor() const;
+
+ virtual enumXFStyle GetStyleFamily() override;
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ enumXFAreaStyle m_eAreaStyle;
+ enumXFAreaLineStyle m_eLineStyle;
+ XFColor m_aBackColor;
+ XFColor m_aLineColor;
+ sal_Int32 m_nAngle;
+ double m_fSpace;
+};
+
+inline void XFDrawAreaStyle::SetAreaStyle(enumXFAreaStyle style)
+{
+ m_eAreaStyle = style;
+}
+
+inline void XFDrawAreaStyle::SetLineStyle(enumXFAreaLineStyle style)
+{
+ m_eLineStyle = style;
+}
+
+inline void XFDrawAreaStyle::SetBackColor(XFColor const & color)
+{
+ m_aBackColor = color;
+}
+
+inline void XFDrawAreaStyle::SetLineColor(XFColor const & color)
+{
+ m_aLineColor = color;
+}
+
+inline void XFDrawAreaStyle::SetLineAngle(sal_Int32 angle)
+{
+ m_nAngle = angle;
+}
+
+inline void XFDrawAreaStyle::SetLineSpace(double space)
+{
+ m_fSpace = space;
+}
+
+inline enumXFAreaStyle XFDrawAreaStyle::GetAreaStyle() const
+{
+ return m_eAreaStyle;
+}
+
+inline const XFColor& XFDrawAreaStyle::GetBackColor() const
+{
+ return m_aBackColor;
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawline.cxx
new file mode 100644
index 000000000..32a68f9df
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawline.cxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line object.
+ ************************************************************************/
+#include <xfilter/xfdrawline.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFDrawLine::XFDrawLine()
+{
+}
+
+void XFDrawLine::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "draw:style-name", GetStyleName() );
+
+ assert(!m_strName.isEmpty() && "name should not be null.");
+ if( !m_strName.isEmpty() )
+ pAttrList->AddAttribute( "draw:name", m_strName );
+ //anchor type:
+ switch( m_eAnchor )
+ {
+ case enumXFAnchorPara:
+ pAttrList->AddAttribute( "text:anchor-type", "paragraph" );
+ break;
+ case enumXFAnchorPage:
+ pAttrList->AddAttribute( "text:anchor-type", "page" );
+ break;
+ case enumXFAnchorChar:
+ pAttrList->AddAttribute( "text:anchor-type", "char" );
+ break;
+ case enumXFAnchorAsChar:
+ pAttrList->AddAttribute( "text:anchor-type", "as-char" );
+ break;
+ case enumXFAnchorFrame:
+ pAttrList->AddAttribute( "text:anchor-type", "frame" );
+ break;
+ default:
+ break;
+ }
+ pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) );
+
+ pAttrList->AddAttribute( "svg:x1", OUString::number(m_aPoint1.GetX()) + "cm" );
+ pAttrList->AddAttribute( "svg:y1", OUString::number(m_aPoint1.GetY()) + "cm" );
+ pAttrList->AddAttribute( "svg:x2", OUString::number(m_aPoint2.GetX()) + "cm" );
+ pAttrList->AddAttribute( "svg:y2", OUString::number(m_aPoint2.GetY()) + "cm" );
+
+ //transform
+ OUString strTransform;
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_ROTATE )
+ strTransform = "rotate (" + OUString::number(m_fRotate) + ") ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_TRANSLATE )
+ strTransform += "translate (" + OUString::number(m_aRotatePoint.GetX()) + "cm " + OUString::number(m_aRotatePoint.GetY()) + "cm) ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWX )
+ strTransform += "skewX (" + OUString::number(0) + " ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWY )
+ strTransform += "skewY (" + OUString::number(0) + " ";
+ strTransform = strTransform.trim();
+
+ if( !strTransform.isEmpty() )
+ pAttrList->AddAttribute( "draw:transform", strTransform );
+
+ pStrm->StartElement( "draw:line" );
+ ContentToXml(pStrm);
+ pStrm->EndElement( "draw:line" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx
new file mode 100644
index 000000000..4c9b4e066
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Line style of Drawing object.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfdrawlinestyle.hxx>
+
+XFDrawLineStyle::XFDrawLineStyle()
+ : m_eLineStyle(enumXFLineSolid)
+ , m_fWidth(0)
+ , m_nTransparency(0)
+ , m_nNumber1(1)
+ , m_nNumber2(1)
+ , m_fSpace(0)
+ , m_fLength1(0)
+ , m_fLength2(0)
+{}
+
+enumXFStyle XFDrawLineStyle::GetStyleFamily()
+{
+ return enumXFStyleStrokeDash;
+}
+
+void XFDrawLineStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "draw:name", GetStyleName());
+ //simple place here:
+ pAttrList->AddAttribute( "draw:style", "rect");
+
+ if( m_eLineStyle == enumXFLineDot )
+ {
+
+ }
+ else if( m_eLineStyle == enumXFLineDash )
+ {
+ pAttrList->AddAttribute( "draw:dots1", OUString::number(m_nNumber1));
+ pAttrList->AddAttribute( " draw:dots1-length", OUString::number(m_fLength1) + "cm");
+
+ pAttrList->AddAttribute( "draw:dots2", OUString::number(m_nNumber2));
+ pAttrList->AddAttribute( " draw:dots2-length", OUString::number(m_fLength2) + "cm");
+ }
+ else if( m_eLineStyle == enumXFLineDotDash )
+ {
+ pAttrList->AddAttribute( "draw:dots1", OUString::number(m_nNumber1));
+
+ pAttrList->AddAttribute( "draw:dots2", OUString::number(m_nNumber2));
+ pAttrList->AddAttribute( " draw:dots2-length", OUString::number(m_fLength2) + "cm");
+ }
+ else if( m_eLineStyle == enumXFLineDashDot )
+ {
+ pAttrList->AddAttribute( "draw:dots1", OUString::number(m_nNumber1));
+ pAttrList->AddAttribute( " draw:dots1-length", OUString::number(m_fLength1) + "cm");
+
+ pAttrList->AddAttribute( "draw:dots2", OUString::number(m_nNumber2));
+ }
+
+ pAttrList->AddAttribute( "draw:distance", OUString::number(m_fSpace) + "cm" );
+
+ pStrm->StartElement( "draw:stroke-dash" );
+ pStrm->EndElement( "draw:stroke-dash" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawobj.cxx b/lotuswordpro/source/filter/xfilter/xfdrawobj.cxx
new file mode 100644
index 000000000..0cac7a8f7
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawobj.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Interface for all Drawing object.
+ ************************************************************************/
+#include <xfilter/xfdrawobj.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFDrawObject::XFDrawObject()
+{
+ m_fRotate = 0;
+ m_nDrawFlag = 0;
+ m_eType = enumXFFrameDrawing;
+}
+
+void XFDrawObject::ContentToXml(IXFStream *pStrm)
+{
+ XFContentContainer::ToXml(pStrm);
+}
+
+void XFDrawObject::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "draw:style-name", GetStyleName() );
+
+ assert(!m_strName.isEmpty() && "name should not be null.");
+ if( !m_strName.isEmpty() )
+ pAttrList->AddAttribute( "draw:name", m_strName );
+ //anchor type:
+ switch( m_eAnchor )
+ {
+ case enumXFAnchorPara:
+ pAttrList->AddAttribute( "text:anchor-type", "paragraph" );
+ break;
+ case enumXFAnchorPage:
+ pAttrList->AddAttribute( "text:anchor-type", "page" );
+ break;
+ case enumXFAnchorChar:
+ pAttrList->AddAttribute( "text:anchor-type", "char" );
+ break;
+ case enumXFAnchorAsChar:
+ pAttrList->AddAttribute( "text:anchor-type", "as-char" );
+ break;
+ case enumXFAnchorFrame:
+ pAttrList->AddAttribute( "text:anchor-type", "frame" );
+ break;
+ default:
+ break;
+ }
+ pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) );
+
+ pAttrList->AddAttribute( "svg:x", OUString::number(m_aRect.GetX()) + "cm" );
+ pAttrList->AddAttribute( "svg:y", OUString::number(m_aRect.GetY()) + "cm" );
+ pAttrList->AddAttribute( "svg:width", OUString::number(m_aRect.GetWidth()) + "cm" );
+ pAttrList->AddAttribute( "svg:height", OUString::number(m_aRect.GetHeight()) + "cm" );
+
+ //transform
+ OUString strTransform;
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_ROTATE )
+ strTransform = "rotate (" + OUString::number(m_fRotate) + ") ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_TRANSLATE )
+ strTransform += "translate (" + OUString::number(m_aRotatePoint.GetX()) + "cm " + OUString::number(m_aRotatePoint.GetY()) + "cm) ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SCALE )
+ strTransform += "scale (" + OUString::number(0) + "cm " + OUString::number(0) + "cm) ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWX )
+ strTransform += "skewX (" + OUString::number(0) + " ";
+ if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWY )
+ strTransform += "skewY (" + OUString::number(0) + " ";
+ strTransform = strTransform.trim();
+
+ if( !strTransform.isEmpty() )
+ pAttrList->AddAttribute( "draw:transform", strTransform );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
new file mode 100644
index 000000000..a356ea5ef
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Draw path object.
+ ************************************************************************/
+#include <xfilter/xfdrawpath.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <rtl/ustrbuf.hxx>
+
+XFSvgPathEntry::XFSvgPathEntry()
+{
+}
+
+OUString XFSvgPathEntry::ToString()
+{
+ assert(!m_strCommand.isEmpty());
+ OUStringBuffer str = m_strCommand;
+
+ for (auto const& point : m_aPoints)
+ {
+ str.append(OUString::number(point.GetX()*1000)).append(" ").append(OUString::number(point.GetY()*1000)).append(" ");
+ }
+ str.stripEnd(' ');
+ return str.makeStringAndClear();
+}
+
+XFDrawPath::XFDrawPath()
+{
+}
+
+void XFDrawPath::MoveTo(XFPoint pt)
+{
+ XFSvgPathEntry entry;
+
+ entry.SetCommand("M");
+ entry.AddPoint(pt);
+ m_aPaths.push_back(entry);
+}
+
+void XFDrawPath::LineTo(XFPoint pt)
+{
+ XFSvgPathEntry entry;
+
+ entry.SetCommand("L");
+ entry.AddPoint(pt);
+ m_aPaths.push_back(entry);
+}
+
+void XFDrawPath::CurveTo(XFPoint dest, XFPoint ctrl1, XFPoint ctrl2)
+{
+ XFSvgPathEntry entry;
+
+ entry.SetCommand("C");
+ entry.AddPoint(ctrl1);
+ entry.AddPoint(ctrl2);
+ entry.AddPoint(dest);
+
+ m_aPaths.push_back(entry);
+}
+
+void XFDrawPath::ClosePath()
+{
+ XFSvgPathEntry entry;
+
+ entry.SetCommand("Z");
+
+ m_aPaths.push_back(entry);
+}
+
+void XFDrawPath::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ //view-box:
+ XFRect rect = m_aRect;
+
+ OUString strViewBox = "0 0 " +
+ OUString::number(rect.GetWidth()*1000) + " " +
+ OUString::number(rect.GetHeight()*1000);
+ pAttrList->AddAttribute( "svg:viewBox", strViewBox);
+
+ //points
+ OUStringBuffer strPath;
+ for (auto & path : m_aPaths)
+ {
+ strPath.append(path.ToString());
+ }
+ if (!strPath.isEmpty())
+ strPath.setLength(strPath.getLength()-1);
+ pAttrList->AddAttribute( "svg:d", strPath.makeStringAndClear());
+
+ SetPosition(rect);
+ XFDrawObject::ToXml(pStrm);
+
+ pStrm->StartElement( "draw:path" );
+ ContentToXml(pStrm);
+ pStrm->EndElement( "draw:path" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
new file mode 100644
index 000000000..c499f8800
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ */
+/*
+ * @file
+ * Polygon object.
+ */
+#include <xfilter/xfdrawpolygon.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <rtl/ustrbuf.hxx>
+
+XFDrawPolygon::XFDrawPolygon()
+{
+}
+
+void XFDrawPolygon::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ //view-box:
+ XFRect rect = CalcViewBox();
+ OUString strViewBox = "0 0 " +
+ OUString::number(rect.GetWidth()*1000) + " " +
+ OUString::number(rect.GetHeight()*1000);
+ pAttrList->AddAttribute( "svg:viewBox", strViewBox);
+
+ //points
+ OUStringBuffer strPoints;
+ for (auto const& point : m_aPoints)
+ {
+ double x = (point.GetX()-rect.GetX())*1000;
+ double y = (point.GetY()-rect.GetY())*1000;
+ strPoints.append(OUString::number(x)).append(" ").append(OUString::number(y)).append(" ");
+ }
+ strPoints.stripEnd(' ');
+ pAttrList->AddAttribute( "draw:points", strPoints.makeStringAndClear());
+
+ SetPosition(rect.GetX(),rect.GetY(),rect.GetWidth(),rect.GetHeight());
+ XFDrawObject::ToXml(pStrm);
+
+ pStrm->StartElement( "draw:polygon" );
+ ContentToXml(pStrm);
+ pStrm->EndElement( "draw:polygon" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
new file mode 100644
index 000000000..ed1ec0691
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Polyline.
+ ************************************************************************/
+#include <xfilter/xfdrawpolyline.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <rtl/ustrbuf.hxx>
+
+XFDrawPolyline::XFDrawPolyline()
+{
+}
+
+void XFDrawPolyline::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ //view-box:
+ XFRect rect = CalcViewBox();
+ OUString strViewBox = "0 0 " +
+ OUString::number(rect.GetWidth()*1000) + " " +
+ OUString::number(rect.GetHeight()*1000);
+ pAttrList->AddAttribute( "svg:viewBox", strViewBox);
+
+ //points
+ OUStringBuffer strPoints;
+ for (auto const& point : m_aPoints)
+ {
+ double x = (point.GetX()-rect.GetX())*1000;
+ double y = (point.GetY()-rect.GetY())*1000;
+ strPoints.append(OUString::number(x)).append(",").append(OUString::number(y)).append(" ");
+ }
+ strPoints.stripEnd(' ');
+ pAttrList->AddAttribute( "draw:points", strPoints.makeStringAndClear());
+
+ SetPosition(rect.GetX(),rect.GetY(),rect.GetWidth(),rect.GetHeight());
+ XFDrawObject::ToXml(pStrm);
+
+ pStrm->StartElement( "draw:polyline" );
+ ContentToXml(pStrm);
+ pStrm->EndElement( "draw:polyline" );
+}
+
+XFRect XFDrawPolyline::CalcViewBox()
+{
+ double x1 = 0;
+ double y1 = 0;
+ double x2 = 0;
+ double y2 = 0;
+ XFPoint aPoint;
+
+ assert(!m_aPoints.empty());
+
+ x1 = aPoint.GetX();
+ x2 = aPoint.GetX();
+ y1 = aPoint.GetY();
+ y2 = aPoint.GetY();
+ for (auto const& point : m_aPoints)
+ {
+ if( x1>point.GetX() )
+ x1 = point.GetX();
+ if( x2<point.GetX() )
+ x2 = point.GetX();
+
+ if( y1>point.GetY() )
+ y1 = point.GetY();
+ if( y2<point.GetY() )
+ y2 = point.GetY();
+ }
+ return XFRect(x1,y1,x2-x1,y2-y1);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawrect.cxx b/lotuswordpro/source/filter/xfilter/xfdrawrect.cxx
new file mode 100644
index 000000000..53fd9ff52
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawrect.cxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Rect object.
+ ************************************************************************/
+#include <xfilter/xfdrawrect.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFDrawRect::XFDrawRect()
+{
+}
+
+void XFDrawRect::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+
+ XFDrawObject::ToXml(pStrm);
+
+ pStrm->StartElement( "draw:rect" );
+ ContentToXml(pStrm);
+ pStrm->EndElement( "draw:rect" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx
new file mode 100644
index 000000000..62abd3afb
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx
@@ -0,0 +1,318 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style for all draw object.
+ ************************************************************************/
+#include <xfilter/xfdrawstyle.hxx>
+#include <xfilter/xfdrawlinestyle.hxx>
+#include <xfilter/xfglobal.hxx>
+#include "xfdrawareastyle.hxx"
+#include <xfilter/xfstylemanager.hxx>
+#include "xffontworkstyle.hxx"
+#include <lwpglobalmgr.hxx>
+XFDrawStyle::XFDrawStyle()
+ : m_pLineStyle(nullptr)
+ , m_pAreaStyle(nullptr)
+ , m_fArrowStartSize(0.3)
+ , m_fArrowEndSize(0.3)
+ , m_bArrowStartCenter(false)
+ , m_bArrowEndCenter(false)
+{}
+
+XFDrawStyle::~XFDrawStyle()
+{
+ //don't delete m_pLineStyle, it was managed by XFStyleManager.
+}
+
+void XFDrawStyle::SetLineStyle(double width, XFColor color)
+{
+ if( !m_pLineStyle )
+ {
+ m_pLineStyle = new XFDrawLineStyle();
+ m_pLineStyle->SetStyleName( XFGlobal::GenStrokeDashName());
+ }
+ m_pLineStyle->SetWidth(width);
+ m_pLineStyle->SetColor(color);
+ m_pLineStyle->SetTransparency(0);
+}
+
+void XFDrawStyle::SetLineDashStyle(enumXFLineStyle style, double len1, double len2, double space )
+{
+ if( !m_pLineStyle )
+ {
+ m_pLineStyle = new XFDrawLineStyle();
+ m_pLineStyle->SetStyleName( XFGlobal::GenStrokeDashName());
+ }
+ m_pLineStyle->SetLineStyle(style);
+ m_pLineStyle->SetDot1Number(1);
+ m_pLineStyle->SetDot1Length(len1);
+ m_pLineStyle->SetDot2Number(1);
+ m_pLineStyle->SetDot2Length(len2);
+ m_pLineStyle->SetSpace(space);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->AddStyle(std::unique_ptr<IXFStyle>(m_pLineStyle));
+}
+
+void XFDrawStyle::SetFontWorkStyle(enumXFFWStyle eStyle, enumXFFWAdjust eAdjust)
+{
+ if (!m_pFontWorkStyle)
+ {
+ m_pFontWorkStyle.reset( new XFFontWorkStyle() );
+ }
+
+ m_pFontWorkStyle->SetButtonForm(0);
+ m_pFontWorkStyle->SetFWStyleType(eStyle);
+ m_pFontWorkStyle->SetFWAdjustType(eAdjust);
+}
+
+void XFDrawStyle::SetAreaColor(XFColor const & color)
+{
+ if( !m_pAreaStyle )
+ {
+ m_pAreaStyle = new XFDrawAreaStyle();
+ m_pAreaStyle->SetStyleName( XFGlobal::GenAreaName());
+ }
+ m_pAreaStyle->SetBackColor(color);
+}
+
+void XFDrawStyle::SetAreaLineStyle(enumXFAreaLineStyle style, sal_Int32 angle, double space, XFColor lineColor)
+{
+ if( !m_pAreaStyle )
+ {
+ m_pAreaStyle = new XFDrawAreaStyle();
+ m_pAreaStyle->SetStyleName( XFGlobal::GenAreaName());
+ }
+ m_pAreaStyle->SetAreaStyle(enumXFAreaHatch);
+
+ m_pAreaStyle->SetLineStyle(style);
+ m_pAreaStyle->SetLineAngle(angle);
+ m_pAreaStyle->SetLineSpace(space);
+ m_pAreaStyle->SetLineColor(lineColor);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ pXFStyleManager->AddStyle(std::unique_ptr<IXFStyle>(m_pAreaStyle));
+}
+
+enumXFStyle XFDrawStyle::GetStyleFamily()
+{
+ return enumXFStyleGraphics;
+}
+
+/**************************************************************************
+ *************************************************************************/
+void XFDrawStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ pAttrList->AddAttribute( "style:family", "graphics" );
+ pStrm->StartElement( "style:style" );
+
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:run-through", "foreground" );
+ pAttrList->AddAttribute( "style:wrap", "none" );
+
+ //line style:
+ if( m_pLineStyle )
+ {
+ //1. if is a dash style, register the stroke-dash style first.
+ if( !m_pLineStyle->IsSolid() )
+ {
+// pAttrList->Clear();
+ pAttrList->AddAttribute( "draw:stroke", "dash" );
+ pAttrList->AddAttribute( "draw:stroke-dash", m_pLineStyle->GetStyleName() );
+ }
+ else
+ {
+ pAttrList->AddAttribute( "draw:stroke", "solid" );
+ }
+
+ if( m_pLineStyle->GetWidth() > 0 )
+ pAttrList->AddAttribute( "svg:stroke-width", OUString::number(m_pLineStyle->GetWidth()) + "cm" );
+
+ XFColor color = m_pLineStyle->GetColor();
+ if( color.IsValid() )
+ pAttrList->AddAttribute( "svg:stroke-color", color.ToString() );
+
+ if( m_pLineStyle->GetTransparency()>0 )
+ pAttrList->AddAttribute( "svg:stroke-opacity", OUString::number(m_pLineStyle->GetTransparency()) + "%" );
+ }
+ else
+ pAttrList->AddAttribute( "draw:stroke", "none" );
+ //area style:
+ if( m_pAreaStyle )
+ {
+ if( enumXFAreaSolid == m_pAreaStyle->GetAreaStyle() )
+ {
+ pAttrList->AddAttribute( "draw:fill", "solid" );
+ XFColor color = m_pAreaStyle->GetBackColor();
+ if( color.IsValid() )
+ pAttrList->AddAttribute( "draw:fill-color", color.ToString() );
+ }
+ else if( enumXFAreaHatch == m_pAreaStyle->GetAreaStyle() )
+ {
+ pAttrList->AddAttribute( "draw:fill", "hatch" );
+ pAttrList->AddAttribute( "draw:fill-hatch-name", m_pAreaStyle->GetStyleName() );
+ XFColor color = m_pAreaStyle->GetBackColor();
+ if( color.IsValid() )
+ {
+ pAttrList->AddAttribute( "draw:fill-hatch-solid", "true" );
+ pAttrList->AddAttribute( "draw:fill-color", color.ToString() );
+ }
+ }
+ }
+ else
+ pAttrList->AddAttribute( "draw:fill", "none" );
+
+ if( !m_strArrowStart.isEmpty() )
+ {
+ pAttrList->AddAttribute( "draw:marker-start", m_strArrowStart );
+ pAttrList->AddAttribute( "draw:marker-start-width", OUString::number(m_fArrowStartSize)+"cm" );
+ if( m_bArrowStartCenter )
+ pAttrList->AddAttribute( "draw:draw:marker-start-center", "true" );
+ }
+ if( !m_strArrowEnd.isEmpty() )
+ {
+ pAttrList->AddAttribute( "draw:marker-end", m_strArrowEnd );
+ pAttrList->AddAttribute( "draw:marker-end-width", OUString::number(m_fArrowEndSize)+"cm" );
+ if( m_bArrowEndCenter )
+ pAttrList->AddAttribute( "draw:draw:marker-end-center", "true" );
+ }
+ if (m_pFontWorkStyle)
+ {
+ // style
+ OUString aStr = "";
+ switch (m_pFontWorkStyle->GetStyleType())
+ {
+ default: // fall through!
+ case enumXFFWOff:
+ break;
+ case enumXFFWRotate:
+ aStr = "rotate";
+ break;
+ case enumXFFWUpright:
+ aStr = "upright";
+ break;
+ case enumXFFWSlantX:
+ aStr = "slant-x";
+ break;
+ case enumXFFWSlantY:
+ aStr = "slant-y";
+ break;
+ }
+ if (!aStr.isEmpty())
+ {
+ pAttrList->AddAttribute("draw:fontwork-style", aStr);
+ }
+
+ //adjust
+ aStr.clear();
+ switch (m_pFontWorkStyle->GetAdjustType())
+ {
+ default: // fall through
+ case enumXFFWAdjustAutosize:
+ aStr = "autosize";
+ break;
+ case enumXFFWAdjustLeft:
+ aStr = "left";
+ break;
+ case enumXFFWAdjustCenter:
+ aStr = "center";
+ break;
+ case enumXFFWAdustRight:
+ aStr = "right";
+ break;
+ }
+ if (!aStr.isEmpty())
+ {
+ pAttrList->AddAttribute("draw:fontwork-adjust", aStr);
+ }
+
+ //form
+ aStr.clear();
+ switch (m_pFontWorkStyle->GetButtonForm())
+ {
+ default: // fall through!
+ case -1:
+ break;
+ case 4:
+ aStr = "top-arc";
+ break;
+ case 5:
+ aStr = "bottom-arc";
+ break;
+ }
+ if (!aStr.isEmpty())
+ {
+ pAttrList->AddAttribute("draw:fontwork-form", aStr);
+ }
+
+ // distance
+ //pAttrList->AddAttribute("draw:fontwork-distance",
+ // OUString::number(m_pFontWorkStyle->GetFWDistance())+"cm");
+ }
+
+ pStrm->StartElement( "style:properties" );
+
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfentry.cxx b/lotuswordpro/source/filter/xfilter/xfentry.cxx
new file mode 100644
index 000000000..fb71ff40f
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfentry.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * index entry object.
+ ************************************************************************/
+
+#include <sal/config.h>
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfentry.hxx>
+
+XFEntry::XFEntry()
+ : m_eType(enumXFEntryTOC)
+ , m_nOutlineLevel(1)
+{}
+
+void XFEntry::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "text:string-value", m_strValue );
+
+ if( m_eType == enumXFEntryTOC )
+ {
+ pAttrList->AddAttribute( "text:outline-level", OUString::number(m_nOutlineLevel) );
+ pStrm->StartElement( "text:toc-mark" );
+// pStrm->Characters(m_strDisplay);
+ pStrm->EndElement( "text:toc-mark" );
+ }
+ else if( m_eType == enumXFEntryAlphabetical )
+ {
+ pAttrList->AddAttribute( "text:key1", m_strKey1 );
+ if( !m_strKey2.isEmpty() )
+ pAttrList->AddAttribute( "text:key2", m_strKey2 );
+
+ pStrm->StartElement( "text:alphabetical-index-mark" );
+// pStrm->Characters(m_strDisplay);
+ pStrm->EndElement( "text:alphabetical-index-mark" );
+ }
+ else if( m_eType == enumXFEntryUserIndex )
+ {
+ pAttrList->AddAttribute( "text:outline-level", OUString::number(m_nOutlineLevel) );
+ pAttrList->AddAttribute( "text:index-name", m_strName );
+
+ pStrm->StartElement( "text:user-index-mark" );
+// pStrm->Characters(m_strDisplay);
+ pStrm->EndElement( "text:user-index-mark" );
+ }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xffloatframe.cxx b/lotuswordpro/source/filter/xfilter/xffloatframe.cxx
new file mode 100644
index 000000000..7a27242cd
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xffloatframe.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Float frame whose anchor is page.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xffloatframe.hxx>
+
+XFFloatFrame::XFFloatFrame(sal_Int32 start, sal_Int32 end, bool all)
+{
+ m_nStart = start;
+ m_nEnd = end;
+ m_bAll = all;
+ SetAnchorType(enumXFAnchorPage);
+}
+
+void XFFloatFrame::ToXml(IXFStream* pStrm)
+{
+ IXFAttrList* pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ for (int i = m_nStart; i <= m_nEnd; i++)
+ {
+ XFFrame::SetAnchorPage(i);
+ XFFrame::ToXml(pStrm);
+ if (!m_bAll)
+ i++;
+ }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xffont.cxx b/lotuswordpro/source/filter/xfilter/xffont.cxx
new file mode 100644
index 000000000..14bb56db6
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xffont.cxx
@@ -0,0 +1,315 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Font object to serial to xml filter.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFFont::XFFont()
+ : m_nFontSize(0)
+ , m_nFontSizeAsia(0)
+ , m_nFontSizeComplex(0)
+ , m_bItalic(false)
+ , m_bItalicAsia(false)
+ , m_bItalicComplex(false)
+ , m_bBold(false)
+ , m_bBoldAsia(false)
+ , m_bBoldComplex(false)
+ , m_eUnderline(enumXFUnderlineNone)
+ , m_eCrossout(enumXFCrossoutNone)
+ , m_eTransform(enumXFTransformNone)
+ , m_bWordByWord(false)
+ , m_nPosition(33)
+ , m_nScale(58)
+ , m_nFlag(0)
+ , m_bTransparent(false)
+{
+}
+/*
+ The Following variable are to be compared:
+ OUString m_strFontName;
+ OUString m_strFontNameAsia;
+ OUString m_strFontNameComplex;
+ sal_Int16 m_nFontSize;
+ sal_Int16 m_nFontSizeAsia;
+ sal_Int16 m_nFontSizeComplex;
+ sal_Bool m_bItalic;
+ sal_Bool m_bItalicAsia;
+ sal_Bool m_bItalicComplex;
+ sal_Bool m_bBold;
+ sal_Bool m_bBoldAsia;
+ sal_Bool m_bBoldComplex;
+ sal_Int16 m_nUnderline;
+ sal_uInt32 m_nUnderlineColor;
+
+ sal_uInt32 m_nFlag;
+*/
+bool operator==(XFFont const & f1, XFFont const & f2)
+{
+ //The most possible entry be first:
+ if( f1.m_nFlag != f2.m_nFlag )
+ return false;
+
+ if( f1.m_strFontName != f2.m_strFontName ||
+ f1.m_strFontNameAsia != f2.m_strFontNameAsia ||
+ f1.m_strFontNameComplex != f2.m_strFontNameComplex
+ )
+ return false;
+
+ if( f1.m_nFontSize != f2.m_nFontSize ||
+ f1.m_nFontSizeAsia != f2.m_nFontSizeAsia ||
+ f1.m_nFontSizeComplex != f2.m_nFontSizeComplex
+ )
+ return false;
+
+ if( f1.m_bItalic != f2.m_bItalic ||
+ f1.m_bItalicAsia != f2.m_bItalicAsia ||
+ f1.m_bItalicComplex != f2.m_bItalicComplex
+ )
+ return false;
+
+ if( f1.m_bBold != f2.m_bBold ||
+ f1.m_bBoldAsia != f2.m_bBoldAsia ||
+ f1.m_bBoldComplex != f2.m_bBoldComplex
+ )
+ return false;
+
+ if( f1.m_nFlag&XFFONT_FLAG_UNDERLINE )
+ {
+ if( f1.m_eUnderline != f2.m_eUnderline )
+ return false;
+ }
+
+ if( f1.m_nFlag&XFFONT_FLAG_UNDERLINECOLOR )
+ {
+ if( f1.m_aUnderlineColor != f2.m_aUnderlineColor )
+ return false;
+ }
+
+ if( f1.m_nFlag&XFFONT_FLAG_CROSSOUT )
+ {
+ if( f1.m_eCrossout != f2.m_eCrossout )
+ return false;
+ }
+
+ if( f1.m_nFlag&XFFONT_FLAG_TRANSFORM )
+ {
+ if( f1.m_eTransform != f2.m_eTransform )
+ return false;
+ }
+
+ if( f1.m_bWordByWord != f2.m_bWordByWord )
+ return false;
+
+ if( f1.m_nFlag&XFFONT_FLAG_POSITION )
+ {
+ if( f1.m_nPosition != f2.m_nPosition )
+ return false;
+ }
+
+ if( f1.m_nFlag&XFFONT_FLAG_SCALE )
+ {
+ if( f1.m_nScale != f2.m_nScale )
+ return false;
+ }
+
+ if( f1.m_nFlag&XFFONT_FLAG_COLOR )
+ {
+ if( f1.m_aColor != f2.m_aColor )
+ return false;
+ }
+
+ if( f1.m_nFlag&XFFONT_FLAG_BGCOLOR )
+ {
+ if( f1.m_aBackColor != f2.m_aBackColor )
+ return false;
+ }
+
+ return true;
+}
+
+bool operator!=(XFFont const & f1, XFFont const & f2)
+{
+ return !(f1==f2);
+}
+
+void XFFont::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( m_nFlag & XFFONT_FLAG_NAME )
+ {
+ pAttrList->AddAttribute("style:font-name",m_strFontName );
+ }
+
+ if( m_nFlag & XFFONT_FLAG_NAME_ASIA )
+ {
+ pAttrList->AddAttribute("style:font-name-asian",m_strFontNameAsia );
+ }
+
+ if( m_nFlag & XFFONT_FLAG_NAME_COMPLEX )
+ {
+ pAttrList->AddAttribute("style:font-name-complex", m_strFontNameComplex);
+ }
+
+ //font size:
+ if( (m_nFlag & XFFONT_FLAG_SIZE) && m_nFontSize != 0 )
+ {
+ OUString strSize = OUString::number(m_nFontSize) + "pt";
+ pAttrList->AddAttribute("fo:font-size",strSize);
+ }
+ if( (m_nFlag & XFFONT_FLAG_SIZE_ASIA) && m_nFontSizeAsia )
+ {
+ OUString strSize = OUString::number(m_nFontSizeAsia) + "pt";
+ pAttrList->AddAttribute("style:font-size-asian",strSize);
+ }
+ if( (m_nFlag & XFFONT_FLAG_SIZE_COMPLEX) && m_nFontSizeComplex )
+ {
+ OUString strSize = OUString::number(m_nFontSizeComplex) + "pt";
+ pAttrList->AddAttribute("style:font-size-complex",strSize);
+ }
+
+ //italic flag:
+ if( ( m_nFlag & XFFONT_FLAG_ITALIC) && m_bItalic )
+ {
+ pAttrList->AddAttribute("fo:font-style", "italic");
+ }
+ if( (m_nFlag & XFFONT_FLAG_ITALIC_ASIA) && m_bItalicAsia )
+ {
+ pAttrList->AddAttribute("style:font-style-asian", "italic");
+ }
+ if( (m_nFlag & XFFONT_FLAG_ITALIC_COMPLEX) && m_bItalicComplex )
+ {
+ pAttrList->AddAttribute("style:font-style-complex", "italic");
+ }
+
+ //Bold flag:
+ if( (m_nFlag & XFFONT_FLAG_BOLD) && m_bBold )
+ {
+ pAttrList->AddAttribute("fo:font-weight", "bold");
+ }
+ if( (m_nFlag & XFFONT_FLAG_BOLD_ASIA) && m_bBoldAsia )
+ {
+ pAttrList->AddAttribute("style:font-weight-asian", "bold");
+ }
+ if( (m_nFlag & XFFONT_FLAG_BOLD_ASIA) && m_bBoldComplex )
+ {
+ pAttrList->AddAttribute("style:font-weight-complex", "bold");
+ }
+ //underline:
+ if( (m_nFlag & XFFONT_FLAG_UNDERLINE) && m_eUnderline )
+ {
+ pAttrList->AddAttribute("style:text-underline", GetUnderlineName(m_eUnderline) );
+ if( m_nFlag & XFFONT_FLAG_UNDERLINECOLOR )
+ {
+ pAttrList->AddAttribute( "style:text-underline-color", m_aUnderlineColor.ToString() );
+ }
+ else
+ pAttrList->AddAttribute( "style:text-underline-color", "font-color" );
+ }
+
+ //enumCrossoutType m_eCrossout;
+ if( (m_nFlag & XFFONT_FLAG_CROSSOUT) && m_eCrossout )
+ {
+ pAttrList->AddAttribute("style:text-crossing-out", GetCrossoutName(m_eCrossout) );
+ }
+
+ if( m_nFlag & XFFONT_FLAG_UNDERLINE || m_nFlag & XFFONT_FLAG_CROSSOUT )
+ {
+ if( m_bWordByWord )
+ pAttrList->AddAttribute("fo:score-spaces", "false" );
+ else
+ pAttrList->AddAttribute("fo:score-spaces", "true" );
+ }
+
+ if( (m_nFlag & XFFONT_FLAG_TRANSFORM) && m_eTransform )
+ {
+ //enumTransformSmallCap is different:
+ if( m_eTransform == enumXFTransformSmallCaps )
+ pAttrList->AddAttribute("fo:font-variant", GetTransformName(m_eTransform) );
+ else
+ pAttrList->AddAttribute("fo:text-transform", GetTransformName(m_eTransform) );
+ }
+
+ //position & scale:
+ if( ((m_nFlag & XFFONT_FLAG_SCALE) && m_nScale>0 ) ||
+ ((m_nFlag & XFFONT_FLAG_POSITION) && m_nPosition != 0)
+ )
+ {
+ OUString tmp = OUString::number(m_nPosition) + "% "
+ + OUString::number(m_nScale) + "%";
+ pAttrList->AddAttribute("style:text-position", tmp );
+ }
+
+ //Color:
+ if( m_nFlag & XFFONT_FLAG_COLOR )
+ {
+ pAttrList->AddAttribute( "fo:color", m_aColor.ToString() );
+ }
+
+ if( m_nFlag & XFFONT_FLAG_BGCOLOR )
+ {
+ if (m_bTransparent)
+ pAttrList->AddAttribute( "style:text-background-color", "transparent");
+ else
+ pAttrList->AddAttribute( "style:text-background-color", m_aBackColor.ToString() );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xffontdecl.cxx b/lotuswordpro/source/filter/xfilter/xffontdecl.cxx
new file mode 100644
index 000000000..b971a2073
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xffontdecl.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Font decl of all used fonts.
+ ************************************************************************/
+#include <xfilter/xffontdecl.hxx>
+
+XFFontDecl::XFFontDecl(const OUString& name, const OUString& family)
+{
+ m_strFontName = name;
+ m_strFontFamily = family;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xffontfactory.cxx b/lotuswordpro/source/filter/xfilter/xffontfactory.cxx
new file mode 100644
index 000000000..a3eb1d921
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xffontfactory.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Implement for font factory which will manage all font.
+ ************************************************************************/
+#include <xfilter/xffontfactory.hxx>
+
+XFFontFactory::XFFontFactory()
+{
+}
+
+XFFontFactory::~XFFontFactory()
+{
+}
+
+void XFFontFactory::AddFont(rtl::Reference<XFFont> const & pFont)
+{
+ s_aFonts.push_back( pFont );
+}
+
+rtl::Reference<XFFont> XFFontFactory::FindSameFont(rtl::Reference<XFFont> const & pFont)
+{
+ for (auto const& font : s_aFonts)
+ {
+ if( *pFont == *font )
+ return font;
+ }
+
+ return nullptr;
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx b/lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx
new file mode 100644
index 000000000..1554fdaf7
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style of Fontwork object.
+ ************************************************************************/
+
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFONTWORKSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFONTWORKSTYLE_HXX
+
+#include <sal/types.h>
+#include <xfilter/xfdefs.hxx>
+
+class XFFontWorkStyle
+{
+public:
+ XFFontWorkStyle() :
+ m_nButtonForm(-1),
+ m_eStyleType(enumXFFWOff),
+ m_eAdjustType(enumXFFWAdjustAutosize)
+ {}
+
+ inline void SetButtonForm(sal_Int8 nIndex);
+ inline void SetFWStyleType(enumXFFWStyle eStyle);
+ inline void SetFWAdjustType(enumXFFWAdjust eAdjust);
+
+ inline sal_Int8 GetButtonForm() const;
+ inline enumXFFWStyle GetStyleType() const;
+ inline enumXFFWAdjust GetAdjustType() const;
+
+private:
+ sal_Int8 m_nButtonForm;
+ enumXFFWStyle m_eStyleType;
+ enumXFFWAdjust m_eAdjustType;
+};
+
+inline void XFFontWorkStyle::SetButtonForm(sal_Int8 nIndex)
+{
+ m_nButtonForm = nIndex;
+}
+
+inline void XFFontWorkStyle::SetFWStyleType(enumXFFWStyle eStyle)
+{
+ m_eStyleType = eStyle;
+}
+
+inline void XFFontWorkStyle::SetFWAdjustType(enumXFFWAdjust eAdjust)
+{
+ m_eAdjustType = eAdjust;
+}
+
+inline sal_Int8 XFFontWorkStyle::GetButtonForm() const
+{
+ return m_nButtonForm;
+}
+
+inline enumXFFWStyle XFFontWorkStyle::GetStyleType() const
+{
+ return m_eStyleType;
+}
+inline enumXFFWAdjust XFFontWorkStyle::GetAdjustType() const
+{
+ return m_eAdjustType;
+}
+
+#endif // INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFONTWORKSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfframe.cxx b/lotuswordpro/source/filter/xfilter/xfframe.cxx
new file mode 100644
index 000000000..f968303da
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfframe.cxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Frame whose anchor is not page.
+ ************************************************************************/
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfframe.hxx>
+#include <xfilter/xfparagraph.hxx>
+#define ZINDEX_MIN 0
+
+XFFrame::XFFrame()
+ : XFFrame::XFFrame(false)
+{}
+
+XFFrame::XFFrame(bool isTextBox)
+ : m_eAnchor(enumXFAnchorPara)
+ , m_nAnchorPage(0)
+ , m_strName(XFGlobal::GenFrameName()) // give it a default name
+ , m_nZIndex(ZINDEX_MIN)
+ , m_fMinHeight(0)
+ , m_eType(enumXFFrameTextbox)
+ , m_nFrameFlag(0)
+ , m_isTextBox(isTextBox)
+{}
+
+XFFrame::~XFFrame()
+{
+}
+
+void XFFrame::Add(XFContent *pContent)
+{
+ if (!pContent)
+ return;
+ XFContentContainer::Add(pContent);
+ if( pContent->GetContentType() == enumXFContentFrame )
+ {
+ XFFrame *pFrame = static_cast<XFFrame*>(pContent);
+ if( pFrame )
+ {
+ pFrame->SetZIndex(pFrame->m_nZIndex + 1);
+ }
+ }
+
+}
+
+void XFFrame::SetZIndex(sal_uInt32 zIndex)
+{
+ if( zIndex == m_nZIndex )
+ return;
+ m_nZIndex = zIndex;
+ AdjustZIndex();
+}
+
+enumXFFrameType XFFrame::GetFrameType() const
+{
+ return m_eType;
+}
+
+enumXFContent XFFrame::GetContentType()
+{
+ return enumXFContentFrame;
+}
+
+void XFFrame::ToXml(IXFStream *pStrm)
+{
+ StartFrame(pStrm);
+
+ XFContentContainer::ToXml(pStrm);
+
+ EndFrame(pStrm);
+}
+
+void XFFrame::StartFrame(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "draw:style-name", GetStyleName() );
+
+ assert(!m_strName.isEmpty() && "name should not be null.");
+ if( !m_strName.isEmpty() && !m_isTextBox)
+ pAttrList->AddAttribute( "draw:name", m_strName );
+ //anchor type:
+ switch( m_eAnchor )
+ {
+ case enumXFAnchorPara:
+ pAttrList->AddAttribute( "text:anchor-type", "paragraph" );
+ break;
+ case enumXFAnchorPage:
+ pAttrList->AddAttribute( "text:anchor-type", "page" );
+ pAttrList->AddAttribute( "text:anchor-page-number", OUString::number(m_nAnchorPage) );
+ break;
+ case enumXFAnchorChar:
+ pAttrList->AddAttribute( "text:anchor-type", "char" );
+ break;
+ case enumXFAnchorAsChar:
+ pAttrList->AddAttribute( "text:anchor-type", "as-char" );
+ break;
+ case enumXFAnchorFrame:
+ pAttrList->AddAttribute( "text:anchor-type", "frame" );
+ break;
+ default:
+ break;
+ }
+ pAttrList->AddAttribute( "svg:x", OUString::number(m_aRect.GetX()) + "cm" );
+ pAttrList->AddAttribute( "svg:y", OUString::number(m_aRect.GetY()) + "cm" );
+ pAttrList->AddAttribute( "svg:width", OUString::number(m_aRect.GetWidth()) + "cm" );
+ if( m_nFrameFlag& XFFRAME_FLAG_MINHEIGHT )
+ {
+ pAttrList->AddAttribute( "fo:min-height", OUString::number(m_fMinHeight) + "cm" );
+ if( m_nFrameFlag&XFFRAME_FLAG_MAXHEIGHT )
+ pAttrList->AddAttribute( "fo:max-height", OUString::number(0) + "cm" );
+ }
+ else
+ pAttrList->AddAttribute( "svg:height", OUString::number(m_aRect.GetHeight()) + "cm" );
+
+ pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) );
+
+ if( !m_strNextLink.isEmpty() )
+ pAttrList->AddAttribute( "draw:chain-next-name", m_strNextLink );
+
+ pStrm->StartElement( "draw:text-box" );
+}
+
+void XFFrame::EndFrame(IXFStream *pStrm)
+{
+ pStrm->EndElement( "draw:text-box" );
+}
+
+void XFFrame::AdjustZIndex()
+{
+ for( int i=0; i<GetCount(); i++ )
+ {
+ rtl::Reference<XFContent> pContent = GetContent(i);
+ if( pContent.is() )
+ {
+ if( pContent->GetContentType() == enumXFContentFrame )
+ {
+ XFFrame *pFrame = static_cast<XFFrame*>(pContent.get());
+ pFrame->m_nZIndex = m_nZIndex + 1;
+ pFrame->AdjustZIndex();
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
new file mode 100644
index 000000000..e3c5b315c
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Frame style include position,size,rotation and so on.
+ ************************************************************************/
+#include <xfilter/xfframestyle.hxx>
+#include <xfilter/xfcolumns.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <xfilter/xfbgimage.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFFrameStyle::XFFrameStyle()
+ : m_eWrap(enumXFWrapNone)
+ , m_bProtectContent(false)
+ , m_bProtectSize(false)
+ , m_bProtectPos(false)
+ , m_nTransparency(0)
+ , m_eTextDir(enumXFTextDirNone)
+ , m_eXPos(enumXFFrameXPosCenter)
+ , m_eXRel(enumXFFrameXRelParaContent)
+ , m_eYPos(enumXFFrameYPosTop)
+ , m_eYRel(enumXFFrameYRelPage)
+{}
+
+XFFrameStyle::~XFFrameStyle()
+{
+}
+
+void XFFrameStyle::SetBorders(std::unique_ptr<XFBorders> pBorders)
+{
+ m_pBorders = std::move(pBorders);
+}
+
+void XFFrameStyle::SetColumns(XFColumns *pColumns)
+{
+ m_pColumns.reset(pColumns);
+}
+
+void XFFrameStyle::SetShadow(XFShadow *pShadow)
+{
+ m_pShadow.reset(pShadow);
+}
+
+void XFFrameStyle::SetBackImage(std::unique_ptr<XFBGImage>& rImage)
+{
+ m_pBGImage = std::move(rImage);
+}
+
+enumXFStyle XFFrameStyle::GetStyleFamily()
+{
+ return enumXFStyleGraphics;
+}
+
+void XFFrameStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( GetParentStyleName().getLength() > 0 )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+ pAttrList->AddAttribute( "style:family", "graphics" );
+ //parent style name ignore now.
+ pStrm->StartElement( "style:style" );
+
+ m_aMargins.ToXml(pStrm);
+
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:run-through", "foreground" );
+
+ if( m_eWrap == enumXFWrapNone )
+ pAttrList->AddAttribute( "style:wrap", "none" );
+ else if( m_eWrap == enumXFWrapLeft )
+ pAttrList->AddAttribute( "style:wrap", "left" );
+ else if( m_eWrap == enumXFWrapRight )
+ pAttrList->AddAttribute( "style:wrap", "right" );
+ else if( m_eWrap == enumXFWrapParallel )
+ pAttrList->AddAttribute( "style:wrap", "parallel" );
+ else if( m_eWrap == enumXFWrapRunThrough )
+ pAttrList->AddAttribute( "style:wrap", "run-through" );
+ else if( m_eWrap == enumXFWrapBest )
+ pAttrList->AddAttribute( "style:wrap", "dynamic" );
+ //}
+ //background
+ if( m_aBackColor.IsValid() )
+ {
+ pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
+ pAttrList->AddAttribute( "style:background-transparency", OUString::number(static_cast<sal_Int32>(m_nTransparency)) + "%");
+ }
+
+ //pad
+ m_aPad.ToXml(pStrm);
+ //margin:
+ m_aMargins.ToXml(pStrm);
+ //border
+ if( m_pBorders )
+ m_pBorders->ToXml(pStrm);
+ else
+ pAttrList->AddAttribute( "fo:border", "none" );
+ //shadow
+ if( m_pShadow )
+ m_pShadow->ToXml(pStrm);
+ //print
+ pAttrList->AddAttribute( "style:print-content", "true" );
+ //text directory
+ if( m_eTextDir != enumXFTextDirNone )
+ pAttrList->AddAttribute( "style:writing-mode", GetTextDirName(m_eTextDir) );
+ //protect:
+ if( m_bProtectContent || m_bProtectSize || m_bProtectPos )
+ {
+ OUString protect;
+ if( m_bProtectContent )
+ protect += "content";
+ if( m_bProtectSize )
+ {
+ if( protect.getLength()>0 )
+ protect += " ";
+ protect += "size";
+ }
+ if( m_bProtectPos )
+ {
+ if( protect.getLength()>0 )
+ protect += " ";
+ protect += "position";
+ }
+ pAttrList->AddAttribute( "style:protect", protect );
+ }
+ //vertical pos and horizon pos:
+ pAttrList->AddAttribute( "style:vertical-pos", GetFrameYPos(m_eYPos) );
+ pAttrList->AddAttribute( "style:vertical-rel", GetFrameYRel(m_eYRel) );
+ pAttrList->AddAttribute( "style:horizontal-pos", GetFrameXPos(m_eXPos) );
+ pAttrList->AddAttribute( "style:horizontal-rel", GetFrameXRel(m_eXRel) );
+
+ pStrm->StartElement( "style:properties" );
+ if( m_pColumns )
+ m_pColumns->ToXml(pStrm);
+ if( m_pBGImage )
+ m_pBGImage->ToXml(pStrm);
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfglobal.cxx b/lotuswordpro/source/filter/xfilter/xfglobal.cxx
new file mode 100644
index 000000000..43d9ca9c9
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfglobal.cxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Global functions or include files that are needed.
+ * It's all for the full filter.
+ ************************************************************************/
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xffontfactory.hxx>
+#include <xfilter/xfstylemanager.hxx>
+
+int XFGlobal::s_nFrameID = 1;
+int XFGlobal::s_nSectionID = 1;
+int XFGlobal::s_nNoteID = 1;
+int XFGlobal::s_nStrokeDashID = 1;
+int XFGlobal::s_nAreaID = 1;
+int XFGlobal::s_nImageID = 1;
+
+OUString XFGlobal::GenSectionName()
+{
+ //give it an initial name:
+ OUString sResult = "sect" + OUString::number(s_nSectionID++);
+ return sResult;
+}
+
+OUString XFGlobal::GenFrameName()
+{
+ //give it an initial name:
+ OUString sResult = "frame" + OUString::number(s_nFrameID++);
+ return sResult;
+}
+
+OUString XFGlobal::GenTableName()
+{
+ OUString sResult = "table" + OUString::number(s_nFrameID++);
+ return sResult;
+}
+
+OUString XFGlobal::GenNoteName()
+{
+ OUString sResult = "ftn" + OUString::number(s_nNoteID++);
+ return sResult;
+}
+
+OUString XFGlobal::GenStrokeDashName()
+{
+ OUString sResult = "stroke dash " + OUString::number(s_nStrokeDashID++);
+ return sResult;
+}
+
+OUString XFGlobal::GenAreaName()
+{
+ OUString sResult = "draw area" + OUString::number(s_nAreaID++);
+ return sResult;
+}
+
+OUString XFGlobal::GenImageName()
+{
+ OUString sResult = "Graphic" + OUString::number(s_nImageID++);
+ return sResult;
+}
+
+void XFGlobal::Reset()
+{
+ s_nSectionID = 1;
+ s_nFrameID = 1;
+ s_nNoteID = 1;
+ s_nStrokeDashID = 1;
+ s_nAreaID = 1;
+}
+
+void XFGlobalReset()
+{
+ // XFFontFactory::Reset();
+ // XFStyleManager::Reset();
+ XFGlobal::Reset();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
new file mode 100644
index 000000000..eb061b6d5
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Header style,exist in page-master object.
+ ************************************************************************/
+#include <xfilter/xfheaderstyle.hxx>
+#include <xfilter/xfbgimage.hxx>
+
+XFHeaderStyle::XFHeaderStyle(bool isFooter)
+{
+ m_bIsFooter = isFooter;
+ m_bDynamicSpace = true;
+ m_fHeight = -1;
+ m_fMinHeight = -1;
+}
+
+XFHeaderStyle::~XFHeaderStyle()
+{
+}
+
+void XFHeaderStyle::SetMargins(double left, double right, double bottom)
+{
+ if( left != -1 )
+ m_aMargin.SetLeft(left);
+ if( right != -1 )
+ m_aMargin.SetRight(right);
+ if( bottom != -1 )
+ m_aMargin.SetBottom(bottom);
+}
+void XFHeaderStyle::SetDynamicSpace(bool dynamic)
+{
+ m_bDynamicSpace = dynamic;
+}
+
+void XFHeaderStyle::SetHeight(double height)
+{
+ m_fHeight = height;
+}
+
+void XFHeaderStyle::SetMinHeight(double minHeight)
+{
+ m_fMinHeight = minHeight;
+}
+
+void XFHeaderStyle::SetShadow(XFShadow *pShadow)
+{
+ if( pShadow == m_pShadow.get() )
+ return;
+ m_pShadow.reset( pShadow );
+}
+
+void XFHeaderStyle::SetBorders(std::unique_ptr<XFBorders> pBorders)
+{
+ m_pBorders = std::move(pBorders);
+}
+
+void XFHeaderStyle::SetBackImage(std::unique_ptr<XFBGImage>& rImage)
+{
+ m_pBGImage = std::move(rImage);
+}
+
+void XFHeaderStyle::SetBackColor(XFColor color)
+{
+ m_aBackColor = color;
+}
+
+void XFHeaderStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ if( m_bIsFooter )
+ pStrm->StartElement( "style:footer-style" );
+ else
+ pStrm->StartElement( "style:header-style" );
+
+ //height
+ if( m_fMinHeight>0 )
+ pAttrList->AddAttribute( "fo:min-height", OUString::number(m_fMinHeight) + "cm" );
+ else if( m_fHeight>0 )
+ pAttrList->AddAttribute( "svg:height", OUString::number(m_fHeight) + "cm" );
+
+ m_aMargin.ToXml(pStrm);
+ if(m_pShadow)
+ m_pShadow->ToXml(pStrm);
+ m_aPadding.ToXml(pStrm);
+ if( m_pBorders )
+ m_pBorders->ToXml(pStrm);
+
+ if( m_aBackColor.IsValid() )
+ pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
+
+ if( m_bDynamicSpace )
+ pAttrList->AddAttribute( "style:dynamic-spacing", "true" );
+ else
+ pAttrList->AddAttribute( "style:dynamic-spacing", "false" );
+
+ pStrm->StartElement( "style:properties" );
+
+ // background image
+ if( m_pBGImage )
+ m_pBGImage->ToXml(pStrm);
+
+ pStrm->EndElement( "style:properties" );
+
+ if( m_bIsFooter )
+ pStrm->EndElement( "style:footer-style" );
+ else
+ pStrm->EndElement( "style:header-style" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfimage.cxx b/lotuswordpro/source/filter/xfilter/xfimage.cxx
new file mode 100644
index 000000000..33f483c7c
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfimage.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Image object.
+ ************************************************************************/
+#include <xfilter/xfimage.hxx>
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include "xfbase64.hxx"
+
+XFImage::XFImage() : m_bUseLink(false)
+{
+ m_eType = enumXFFrameImage;
+ m_strName = XFGlobal::GenImageName();
+}
+
+void XFImage::SetFileURL(const OUString& url)
+{
+ m_strImageFile = url;
+ m_bUseLink = true;
+}
+
+void XFImage::SetImageData(sal_uInt8 const *buf, int len)
+{
+ m_strData = XFBase64::Encode(buf, len);
+ m_bUseLink = false;
+}
+
+/*
+ <text:p text:style-name="Standard">
+ <draw:image draw:style-name="fr1" draw:name="Graphic1"
+ text:anchor-type="paragraph" svg:width="4.981cm" svg:height="4.77cm"
+ draw:z-index="0" xlink:href="file:///d:/bee.wmf" xlink:type="simple"
+ xlink:show="embed" xlink:actuate="onLoad"/>
+ </text:p>
+ */
+void XFImage::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "draw:style-name", GetStyleName() );
+
+ assert(!m_strName.isEmpty() && "name should not be null.");
+ if( !m_strName.isEmpty() )
+ pAttrList->AddAttribute( "draw:name", m_strName );
+ //anchor type:
+ switch( m_eAnchor )
+ {
+ case enumXFAnchorPara:
+ pAttrList->AddAttribute( "text:anchor-type", "paragraph" );
+ break;
+ case enumXFAnchorPage:
+ pAttrList->AddAttribute( "text:anchor-type", "page" );
+ pAttrList->AddAttribute( "text:anchor-page-number", OUString::number(m_nAnchorPage) );
+ break;
+ case enumXFAnchorChar:
+ pAttrList->AddAttribute( "text:anchor-type", "char" );
+ break;
+ case enumXFAnchorAsChar:
+ pAttrList->AddAttribute( "text:anchor-type", "as-char" );
+ break;
+ case enumXFAnchorFrame:
+ pAttrList->AddAttribute( "text:anchor-type", "frame" );
+ break;
+ default:
+ break;
+ }
+ pAttrList->AddAttribute( "svg:x", OUString::number(m_aRect.GetX()) + "cm" );
+ pAttrList->AddAttribute( "svg:y", OUString::number(m_aRect.GetY()) + "cm" );
+ pAttrList->AddAttribute( "svg:width", OUString::number(m_aRect.GetWidth()) + "cm" );
+ pAttrList->AddAttribute( "svg:height", OUString::number(m_aRect.GetHeight()) + "cm" );
+ pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) );
+
+ if( m_bUseLink )
+ {
+ pAttrList->AddAttribute( "xlink:href", m_strImageFile );
+ pAttrList->AddAttribute( "xlink:type", "simple" );
+ pAttrList->AddAttribute( "xlink:show", "embed" );
+ pAttrList->AddAttribute( "xlink:actuate", "onLoad" );
+ }
+
+ pStrm->StartElement( "draw:image" );
+ if( !m_bUseLink )
+ {
+ pAttrList->Clear();
+ pStrm->StartElement( "office:binary-data" );
+ pStrm->Characters(m_strData);
+ pStrm->EndElement( "office:binary-data" );
+ }
+ pStrm->EndElement( "draw:image" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfimagestyle.cxx b/lotuswordpro/source/filter/xfilter/xfimagestyle.cxx
new file mode 100644
index 000000000..0694fdc26
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfimagestyle.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Image style object.
+ ************************************************************************/
+#include <xfilter/xfimagestyle.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFImageStyle::XFImageStyle()
+ : m_nBrightness(0)
+ , m_nContrast(0)
+ , m_fClipLeft(0)
+ , m_fClipRight(0)
+ , m_fClipTop(0)
+ , m_fClipBottom(0)
+{}
+
+void XFImageStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+ pAttrList->AddAttribute( "style:family", "graphics" );
+ //parent style name ignore now.
+ pStrm->StartElement( "style:style" );
+
+ m_aMargins.ToXml(pStrm);
+
+ pAttrList->Clear();
+
+ if( m_eWrap == enumXFWrapBackground )
+ {
+ pAttrList->AddAttribute( "style:run-through", "background" );
+ }
+ else
+ {
+ pAttrList->AddAttribute( "style:run-through", "foreground" );
+
+ if( m_eWrap == enumXFWrapNone )
+ pAttrList->AddAttribute( "style:wrap", "none" );
+ else if( m_eWrap == enumXFWrapLeft )
+ pAttrList->AddAttribute( "style:wrap", "left" );
+ else if( m_eWrap == enumXFWrapRight )
+ pAttrList->AddAttribute( "style:wrap", "right" );
+ else if( m_eWrap == enumXFWrapParallel )
+ pAttrList->AddAttribute( "style:wrap", "parallel" );
+ else if( m_eWrap == enumXFWrapRunThrough )
+ pAttrList->AddAttribute( "style:wrap", "run-through" );
+ else if( m_eWrap == enumXFWrapBest )
+ pAttrList->AddAttribute( "style:wrap", "dynamic" );
+ }
+ //background
+ if( m_aBackColor.IsValid() )
+ pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
+ //pad
+ m_aPad.ToXml(pStrm);
+ //margin:
+ m_aMargins.ToXml(pStrm);
+
+ if( m_nBrightness )
+ pAttrList->AddAttribute( "draw:luminance", OUString::number(m_nBrightness) + "%" );
+ if( m_nContrast )
+ pAttrList->AddAttribute( "draw:contrast", OUString::number(m_nContrast) + "%" );
+
+ pAttrList->AddAttribute("draw:color-mode", GetColorMode(enumXFColorStandard));
+ //border
+ if( m_pBorders )
+ m_pBorders->ToXml(pStrm);
+ //shadow
+ if( m_pShadow )
+ m_pShadow->ToXml(pStrm);
+
+ pAttrList->AddAttribute( "style:print-content", "true" );
+ //protect:
+ if( m_bProtectContent || m_bProtectSize || m_bProtectPos )
+ {
+ OUString protect;
+ if( m_bProtectContent )
+ protect += "content";
+ if( m_bProtectSize )
+ {
+ if( !protect.isEmpty() )
+ protect += " ";
+ protect += "size";
+ }
+ if( m_bProtectPos )
+ {
+ if( !protect.isEmpty() )
+ protect += " ";
+ protect += "position";
+ }
+ pAttrList->AddAttribute( "style:protect", protect );
+ }
+ //vertical pos and horizon pos:
+ pAttrList->AddAttribute( "style:vertical-pos", GetFrameYPos(m_eYPos) );
+ pAttrList->AddAttribute( "style:vertical-rel", GetFrameYRel(m_eYRel) );
+ pAttrList->AddAttribute( "style:horizontal-pos", GetFrameXPos(m_eXPos) );
+ pAttrList->AddAttribute( "style:horizontal-rel", GetFrameXRel(m_eXRel) );
+
+ //clip:
+ if( FABS(m_fClipLeft)>FLOAT_MIN || FABS(m_fClipRight)>FLOAT_MIN || FABS(m_fClipTop)>FLOAT_MIN || FABS(m_fClipBottom)>FLOAT_MIN )
+ {
+ OUString clip = "rect(" + OUString::number(m_fClipTop) + "cm " +
+ OUString::number(m_fClipRight) + "cm " +
+ OUString::number(m_fClipBottom) + "cm " +
+ OUString::number(m_fClipLeft) + "cm)";
+ pAttrList->AddAttribute("fo:clip",clip);
+ }
+
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfindex.cxx b/lotuswordpro/source/filter/xfilter/xfindex.cxx
new file mode 100644
index 000000000..4feb10bd9
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfindex.cxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Represents index source, index body and index entry.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfindex.hxx>
+#include <xfilter/xfparagraph.hxx>
+
+XFIndex::XFIndex()
+ : m_eType(enumXFIndexTOC)
+ , m_bProtect(true)
+ , m_bSeparator(false)
+{}
+
+XFIndex::~XFIndex()
+{
+}
+
+void XFIndex::AddTemplate(const OUString& level, const OUString& style, XFIndexTemplate* templ)
+{
+ templ->SetLevel( level );
+ if(m_eType != enumXFIndexTOC) // TOC's styles are applied to template entries separately
+ {
+ templ->SetStyleName( style );
+ }
+ m_aTemplates.push_back( templ );
+}
+
+void XFIndex::SetProtected(bool protect)
+{
+ m_bProtect = protect;
+}
+
+void XFIndex::SetSeparator(bool sep)
+{
+ m_bSeparator = sep;
+}
+
+void XFIndex::AddTocSource(sal_uInt16 nLevel, const OUString& sStyleName)
+{
+ if (nLevel > MAX_TOC_LEVEL)
+ {
+ return;
+ }
+
+ m_aTOCSource[nLevel].push_back(sStyleName);
+}
+
+void XFIndex::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ OUString strIndexName;
+ OUString strTplName;
+ OUString strSourceName;
+
+ if(m_eType == enumXFIndexTOC )
+ {
+ strIndexName = "text:table-of-content";
+ strSourceName = "text:table-of-content-source";
+ strTplName = "text:table-of-content-entry-template";
+ }
+ else if( m_eType == enumXFIndexAlphabetical )
+ {
+ strIndexName = "text:alphabetical-index";
+ strSourceName = "text:alphabetical-index-source";
+ strTplName = "text:alphabetical-index-entry-template";
+ }
+ else if( m_eType == enumXFIndexUserIndex )
+ {
+ strIndexName = "text:user-index";
+ strSourceName = "text:text:user-index-source";
+ strTplName = "text:user-index-entry-template";
+ }
+ else if( m_eType == enumXFIndexObject )
+ {
+ strIndexName = "text:object-index";
+ strSourceName = "text:object-index-source";
+ strTplName = "text:object-index-entry-template";
+ }
+ else if( m_eType == enumXFIndexIllustration )
+ {
+ strIndexName = "text:illustration-index";
+ strSourceName = "text:illustration-index-source";
+ strTplName = "text:illustration-index-entry-template";
+ }
+ else if( m_eType == enumXFIndexTableIndex )
+ {
+ strIndexName = "text:table-index";
+ strSourceName = "text:table-index-source";
+ strTplName = "text:table-index-entry-template";
+ }
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+ if( m_bProtect )
+ pAttrList->AddAttribute( "text:protected", "true" );
+ else
+ pAttrList->AddAttribute( "text:protected", "false" );
+
+ pAttrList->AddAttribute( "text:name", m_strTitle );
+ pStrm->StartElement( strIndexName );
+
+ //text:table-of-content-source:
+ pAttrList->Clear();
+
+ if(m_eType == enumXFIndexTOC )
+ {
+ pAttrList->AddAttribute( "text:outline-level", OUString::number(10));
+ pAttrList->AddAttribute( "text:use-index-source-styles", "true");
+ pAttrList->AddAttribute( "text:use-index-marks", "true");
+ pAttrList->AddAttribute( "text:use-outline-level", "false");
+ }
+ if (m_bSeparator)
+ pAttrList->AddAttribute( "text:alphabetical-separators", "true" );
+
+ pStrm->StartElement( strSourceName );
+ //title template:
+ pAttrList->Clear();
+
+ pStrm->StartElement( "text:index-title-template" );
+ pStrm->Characters( m_strTitle );
+ pStrm->EndElement( "text:index-title-template" );
+
+ //entry templates:
+ for (auto const& elem : m_aTemplates)
+ {
+ elem->SetTagName( strTplName);
+ elem->ToXml(pStrm);
+ }
+
+ // by
+ if(m_eType == enumXFIndexTOC )
+ {
+ for(sal_uInt16 i=1; i <= MAX_TOC_LEVEL; i++)
+ {
+ if (m_aTOCSource[i].empty())
+ {
+ // unnecessary to output this level
+ continue;
+ }
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:outline-level", OUString::number(i));
+ pStrm->StartElement( "text:index-source-styles" );
+
+ for (auto const& elemTOCSource : m_aTOCSource[i])
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:style-name", elemTOCSource);
+ pStrm->StartElement( "text:index-source-style" );
+ pStrm->EndElement( "text:index-source-style" );
+ }
+ pStrm->EndElement( "text:index-source-styles" );
+ }
+ }
+
+ pStrm->EndElement( strSourceName );
+
+ //index-body:
+ pAttrList->Clear();
+ pStrm->StartElement( "text:index-body" );
+ //index-title:
+ if(!m_strTitle.isEmpty())
+ {
+ pAttrList->AddAttribute( "text:name", m_strTitle + "_Head" );
+ pStrm->StartElement( "text:index-title" );
+ pStrm->EndElement( "text:index-title" );
+ }
+
+ XFContentContainer::ToXml(pStrm);
+ pStrm->EndElement( "text:index-body" );
+
+ pStrm->EndElement( strIndexName );
+}
+
+void XFIndexTemplate::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "text:outline-level", m_nLevel );
+ pAttrList->AddAttribute( "text:style-name", m_strStyle );
+ if( m_strTagName.isEmpty() )
+ m_strTagName = "text:table-of-content-entry-template";
+ pStrm->StartElement( m_strTagName );
+
+ for( size_t i=0; i<m_aEntries.size(); i++ )
+ {
+ pAttrList->Clear();
+
+ switch( m_aEntries[i].first )
+ {
+ case enumXFIndexTemplateChapter:
+ if(!m_aEntries[i].second.isEmpty())
+ pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second );
+
+ pStrm->StartElement( "text:index-entry-chapter-number" );
+ pStrm->EndElement( "text:index-entry-chapter-number" );
+ break;
+ case enumXFIndexTemplateText:
+ if(!m_aEntries[i].second.isEmpty())
+ pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second );
+
+ pStrm->StartElement( "text:index-entry-text" );
+ pStrm->EndElement( "text:index-entry-text" );
+ break;
+ case enumXFIndexTemplateTab:
+ if( m_eTabType != enumXFTabRight )
+ pAttrList->AddAttribute( "style:position", OUString::number(m_fTabLength) + "cm" );
+
+ if(!m_aEntries[i].second.isEmpty())
+ pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second );
+
+ switch(m_eTabType)
+ {
+ case enumXFTabLeft:
+ pAttrList->AddAttribute( "style:type", "left" );
+ break;
+ case enumXFTabCenter:
+ pAttrList->AddAttribute( "style:type", "center" );
+ break;
+ case enumXFTabRight:
+ pAttrList->AddAttribute( "style:type", "right" );
+ break;
+ case enumXFTabChar:
+ pAttrList->AddAttribute( "style:type", "char" );
+ break;
+ default:
+ break;
+ }
+ //delimiter:
+ if( m_eTabType == enumXFTabChar )
+ pAttrList->AddAttribute( "style:char", m_strTabDelimiter );
+ //leader char:
+ if( !m_strTabLeader.isEmpty() )
+ pAttrList->AddAttribute( "style:leader-char", m_strTabLeader );
+
+ pStrm->StartElement( "text:index-entry-tab-stop" );
+ pStrm->EndElement( "text:index-entry-tab-stop" );
+ break;
+ case enumXFIndexTemplatePage:
+ if(!m_aEntries[i].second.isEmpty())
+ pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second );
+
+ pStrm->StartElement( "text:index-entry-page-number" );
+ pStrm->EndElement( "text:index-entry-page-number" );
+ break;
+ case enumXFIndexTemplateLinkStart:
+ pStrm->StartElement( "text:index-entry-link-start" );
+ pStrm->EndElement( "text:index-entry-link-start" );
+ break;
+ case enumXFIndexTemplateLinkEnd:
+ pStrm->StartElement( "text:index-entry-link-end" );
+ pStrm->EndElement( "text:index-entry-link-end" );
+ break;
+ case enumXFIndexTemplateSpan:
+ pAttrList->Clear();
+ pAttrList->AddAttribute("text:style-name", GetStyleName());
+ pStrm->StartElement( "text:index-entry-span" );
+ pStrm->Characters(m_aTextEntries[i]);
+ pStrm->EndElement( "text:index-entry-span" );
+ break;
+ case enumXFIndexTemplateBibliography:
+ pStrm->StartElement( "text:index-entry-bibliography" );
+ pStrm->EndElement( "text:index-entry-bibliography" );
+ break;
+ default:
+ break;
+ }
+ }
+
+ pStrm->EndElement( m_strTagName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xflist.cxx b/lotuswordpro/source/filter/xfilter/xflist.cxx
new file mode 100644
index 000000000..b9e71c302
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xflist.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * List object.
+ ************************************************************************/
+#include <xfilter/xflist.hxx>
+#include <xfilter/xflistitem.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFList::XFList()
+{
+ m_bOrdered = true;
+ m_bContinueNumber = false;
+}
+
+XFList::~XFList()
+{
+}
+
+void XFList::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ assert(nullptr!=pAttrList);
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+ if( m_bContinueNumber )
+ pAttrList->AddAttribute( "text:continue-numbering", "true" );
+
+ if( m_bOrdered )
+ pStrm->StartElement( "text:ordered-list" );
+ else
+ pStrm->StartElement( "text:unordered-list" );
+
+ XFContentContainer::ToXml(pStrm);
+
+ if( m_bOrdered )
+ pStrm->EndElement( "text:ordered-list" );
+ else
+ pStrm->EndElement( "text:unordered-list" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx
new file mode 100644
index 000000000..4f4f32ea7
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Styles for ordered list and unordered list.
+ ************************************************************************/
+#include <xfilter/xfliststyle.hxx>
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFListLevel::XFListLevel()
+ : m_nLevel(0)
+ , m_nDisplayLevel(0)
+ , m_fIndent(0)
+ , m_fMinLabelWidth(0.499)
+ , m_fMinLabelDistance(0)
+ , m_eAlign(enumXFAlignStart)
+ , m_eListType(enumXFListLevelNumber)
+{}
+
+void XFListLevel::ToXml(IXFStream * /*pStrm*/)
+{
+}
+
+void XFListlevelNumber::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:level", OUString::number(static_cast<sal_Int32>(m_nLevel)) );
+ //text:style-name,ignore now.
+ m_aNumFmt.ToXml(pStrm);
+ if( m_nDisplayLevel )
+ pAttrList->AddAttribute( "text:display-levels", OUString::number(static_cast<sal_Int32>(m_nDisplayLevel)) );
+
+ pStrm->StartElement( "text:list-level-style-number" );
+
+ //<style:properties>...</style:properties>
+ pAttrList->Clear();
+ if( m_fIndent > FLOAT_MIN )
+ {
+ pAttrList->AddAttribute( "text:space-before", OUString::number(m_fIndent) + "cm" );
+ }
+ if( m_fMinLabelWidth > FLOAT_MIN )
+ {
+ pAttrList->AddAttribute( "text:min-label-width", OUString::number(m_fMinLabelWidth) + "cm" );
+ }
+ if( m_fMinLabelDistance > FLOAT_MIN )
+ {
+ pAttrList->AddAttribute( "text:min-label-distance", OUString::number(m_fMinLabelDistance) + "cm" );
+ }
+ pAttrList->AddAttribute( "fo:text-align", GetAlignName(m_eAlign) );
+
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "text:list-level-style-number" );
+}
+
+void XFListLevelBullet::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:level", OUString::number(static_cast<sal_Int32>(m_nLevel)) );
+ //text:style-name,ignore now.
+ m_aNumFmt.ToXml(pStrm);
+ //bullet-char
+ pAttrList->AddAttribute( "text:bullet-char", m_chBullet );
+
+ pStrm->StartElement( "text:list-level-style-bullet" );
+
+ //<style:properties>...</style:properties>
+ pAttrList->Clear();
+ if( m_fIndent != 0 )
+ {
+ pAttrList->AddAttribute( "text:space-before", OUString::number(m_fIndent) + "cm" );
+ }
+ if( m_fMinLabelWidth != 0 )
+ {
+ pAttrList->AddAttribute( "text:min-label-width", OUString::number(m_fMinLabelWidth) + "cm" );
+ }
+ if( m_fMinLabelDistance != 0 )
+ {
+ pAttrList->AddAttribute( "text:min-label-distance", OUString::number(m_fMinLabelDistance) + "cm" );
+ }
+
+ pAttrList->AddAttribute( "fo:text-align", GetAlignName(m_eAlign) );
+
+ if( !m_strFontName.isEmpty() )
+ {
+ pAttrList->AddAttribute( "style:font-name", m_strFontName );
+ }
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "text:list-level-style-bullet" );
+}
+
+XFListStyle::XFListStyle()
+{
+ XFNumFmt nf;
+ nf.SetSuffix( "." );
+ nf.SetFormat( "1" );
+
+ for( int i=0; i<10; i++ )
+ {
+ m_pListLevels[i].reset(new XFListlevelNumber());
+ m_pListLevels[i]->SetListlevelType(enumXFListLevelNumber);
+ m_pListLevels[i]->SetMinLabelWidth(0.499);
+ m_pListLevels[i]->SetIndent(0.501*(i+1));
+ m_pListLevels[i]->SetLevel(i+1);
+ static_cast<XFListlevelNumber*>(m_pListLevels[i].get())->SetNumFmt(nf);
+ }
+}
+
+XFListStyle::XFListStyle(const XFListStyle& other):XFStyle(other)
+{
+ for( int i=0; i<10; i++ )
+ {
+ const enumXFListLevel type = other.m_pListLevels[i]->m_eListType;
+ if( type == enumXFListLevelNumber )
+ {
+ XFListlevelNumber *pNum = static_cast<XFListlevelNumber*>(other.m_pListLevels[i].get());
+ m_pListLevels[i].reset(new XFListlevelNumber(*pNum));
+ }
+ else if( type == enumXFListLevelBullet )
+ {
+ XFListLevelBullet *pBullet = static_cast<XFListLevelBullet*>(other.m_pListLevels[i].get());
+ m_pListLevels[i].reset(new XFListLevelBullet(*pBullet));
+ }
+ else
+ m_pListLevels[i].reset();
+ }
+}
+
+XFListStyle::~XFListStyle()
+{
+}
+
+void XFListStyle::SetDisplayLevel(sal_Int32 level, sal_Int16 nDisplayLevel)
+{
+ assert(level>=1&&level<=10);
+
+ XFListLevel *pLevel = m_pListLevels[level-1].get();
+ if( !pLevel )
+ {
+ m_pListLevels[level-1].reset(new XFListlevelNumber());
+ pLevel = m_pListLevels[level-1].get();
+ pLevel->SetListlevelType(enumXFListLevelNumber);
+ pLevel->SetLevel(level+1);
+ pLevel->SetMinLabelWidth(0.499);
+ pLevel->SetIndent(0.501*(level+1));
+ }
+ pLevel->SetDisplayLevel(nDisplayLevel);
+}
+
+void XFListStyle::SetListPosition(sal_Int32 level,
+ double indent,
+ double minLabelWidth,
+ double minLabelDistance,
+ enumXFAlignType align
+ )
+{
+ assert(level>=1&&level<=10);
+
+ XFListLevel *pLevel = m_pListLevels[level-1].get();
+ if( !pLevel )
+ {
+ m_pListLevels[level-1].reset( new XFListLevelBullet() );
+ pLevel = m_pListLevels[level-1].get();
+ pLevel->SetListlevelType(enumXFListLevelNumber);
+ pLevel->SetLevel(level+1);
+ }
+ pLevel->SetIndent(indent);
+ pLevel->SetMinLabelWidth(minLabelWidth);
+ pLevel->SetMinLabelDistance(minLabelDistance);
+ pLevel->SetAlignType(align);
+}
+
+void XFListStyle::SetListBullet(sal_Int32 level,
+ OUString const & bullet,
+ const OUString& fontname,
+ const OUString& prefix,
+ const OUString& suffix
+ )
+{
+ assert(level>=1&&level<=10);
+
+ std::unique_ptr<XFListLevelBullet> pLevel(new XFListLevelBullet());
+ pLevel->SetPrefix(prefix);
+ pLevel->SetSuffix(suffix);
+ pLevel->SetBulletChar(bullet);
+ pLevel->SetFontName(fontname);
+
+ pLevel->SetListlevelType(enumXFListLevelBullet);
+ pLevel->SetMinLabelWidth(0.499);
+ pLevel->SetIndent(0.501*level);
+ pLevel->SetLevel(level);
+ m_pListLevels[level-1] = std::move(pLevel);
+}
+
+void XFListStyle::SetListNumber(sal_Int32 level, XFNumFmt const & fmt, sal_Int16 start )
+{
+ assert(level>=1&&level<=10);
+
+ std::unique_ptr<XFListlevelNumber> pLevel(new XFListlevelNumber());
+ pLevel->SetNumFmt(fmt);
+ pLevel->SetStartValue(start);
+
+ pLevel->SetListlevelType(enumXFListLevelNumber);
+ pLevel->SetMinLabelWidth(0.499);
+ pLevel->SetIndent(0.501*level);
+ pLevel->SetLevel(level);
+ m_pListLevels[level-1] = std::move(pLevel);
+}
+
+void XFListStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+ pStrm->StartElement( "text:list-style" );
+
+ for(auto const & pLevel : m_pListLevels)
+ {
+ if( pLevel )
+ pLevel->ToXml(pStrm);
+ }
+
+ pStrm->EndElement( "text:list-style" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfmargins.cxx b/lotuswordpro/source/filter/xfilter/xfmargins.cxx
new file mode 100644
index 000000000..b6aab56d0
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfmargins.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Margins object, include left margin,right margin,top margin and bottom margin.
+ ************************************************************************/
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfmargins.hxx>
+
+XFMargins::XFMargins()
+{
+ Reset();
+}
+
+void XFMargins::Reset()
+{
+ m_fLeft = 0;
+ m_fRight = 0;
+ m_fTop = 0;
+ m_fBottom = 0;
+ m_nFlag = 0;
+}
+
+void XFMargins::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ //margin left:
+ if( m_nFlag&XFMARGINS_FLAG_LEFT )
+ {
+ pAttrList->AddAttribute( "fo:margin-left", OUString::number(m_fLeft) + "cm" );
+ }
+ //margin right:
+ if( m_nFlag&XFMARGINS_FLAG_RIGHT )
+ {
+ pAttrList->AddAttribute("fo:margin-right", OUString::number(m_fRight) + "cm" );
+ }
+ //margin top:
+ if( m_nFlag&XFMARGINS_FLAG_TOP )
+ {
+ pAttrList->AddAttribute("fo:margin-top", OUString::number(m_fTop) + "cm" );
+ }
+ //margin bottom:
+ if( m_nFlag&XFMARGINS_FLAG_BOTTOM )
+ {
+ pAttrList->AddAttribute("fo:margin-bottom", OUString::number(m_fBottom) + "cm" );
+ }
+}
+
+bool operator==(XFMargins const & indent1, XFMargins const & indent2)
+{
+ return (
+ (indent1.m_nFlag == indent2.m_nFlag) &&
+ (indent1.m_fLeft == indent2.m_fLeft) &&
+ (indent1.m_fRight == indent2.m_fRight) &&
+ (indent1.m_fTop == indent2.m_fTop) &&
+ (indent1.m_fBottom == indent2.m_fBottom)
+ );
+}
+bool operator!=(XFMargins const & indent1, XFMargins const & indent2)
+{
+ return !(indent1==indent2);
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
new file mode 100644
index 000000000..d92a0218a
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Master page object which was used to apply a layout to the pages.
+ ************************************************************************/
+#include <xfilter/xfmasterpage.hxx>
+#include <xfilter/xfpagemaster.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xffooter.hxx>
+#include <xfilter/xfheader.hxx>
+#include <lwpglobalmgr.hxx>
+
+void XFMasterPage::SetHeader(rtl::Reference<XFHeader> const & rHeader)
+{
+ m_xHeader = rHeader;
+}
+
+void XFMasterPage::SetFooter(rtl::Reference<XFFooter> const & rFooter)
+{
+ m_xFooter = rFooter;
+}
+
+enumXFStyle XFMasterPage::GetStyleFamily()
+{
+ return enumXFStyleMasterPage;
+}
+
+void XFMasterPage::SetPageMaster(const OUString& pm)
+{
+ m_strPageMaster = pm;
+}
+
+void XFMasterPage::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", m_strStyleName );
+ pAttrList->AddAttribute( "style:page-master-name", m_strPageMaster );
+ pStrm->StartElement( "style:master-page" );
+ if (m_xHeader)
+ m_xHeader->ToXml(pStrm);
+ if (m_xFooter)
+ m_xFooter->ToXml(pStrm);
+ pStrm->EndElement( "style:master-page" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx b/lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx
new file mode 100644
index 000000000..169f5e7e5
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Number style for table cell.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfnumberstyle.hxx>
+
+XFNumberStyle::XFNumberStyle()
+ : m_eType(enumXFNumberNumber)
+ , m_nDecimalDigits(0)
+ , m_bGroup(false)
+ , m_aColor(0,0,0)
+ , m_bRedIfNegative(false)
+ , m_aNegativeColor(255,0,0)
+{}
+
+enumXFStyle XFNumberStyle::GetStyleFamily()
+{
+ return enumXFStyleNumber;
+}
+
+bool XFNumberStyle::Equal(IXFStyle *pStyle)
+{
+ if( !pStyle || pStyle->GetStyleFamily() != enumXFStyleNumber )
+ return false;
+ XFNumberStyle *pOther = dynamic_cast<XFNumberStyle*>(pStyle);
+ if( !pOther )
+ return false;
+
+ if( m_eType != pOther->m_eType )
+ return false;
+ if( m_nDecimalDigits != pOther->m_nDecimalDigits )
+ return false;
+ if( m_bRedIfNegative != pOther->m_bRedIfNegative )
+ return false;
+ if( m_bGroup != pOther->m_bGroup )
+ return false;
+ if( m_aColor != pOther->m_aColor )
+ return false;
+ if( m_strPrefix != pOther->m_strPrefix )
+ return false;
+ if( m_strSuffix != pOther->m_strSuffix )
+ return false;
+
+ if( m_bRedIfNegative )
+ {
+ if( m_aNegativeColor != pOther->m_aNegativeColor )
+ return false;
+ if( m_strNegativePrefix != pOther->m_strNegativePrefix )
+ return false;
+ if( m_strNegativeSuffix != pOther->m_strNegativeSuffix )
+ return false;
+ }
+
+ if( m_eType == enuMXFNumberCurrency )
+ {
+ if( m_strCurrencySymbol != pOther->m_strCurrencySymbol )
+ return false;
+ }
+
+ return true;
+}
+
+void XFNumberStyle::ToXml(IXFStream *pStrm)
+{
+ // for Text content number format
+ if (m_eType == enumXFText)
+ {
+ ToXml_StartElement(pStrm);
+ ToXml_EndElement(pStrm);
+ return;
+ }
+
+ if( !m_bRedIfNegative )
+ {
+ ToXml_Normal(pStrm);
+ }
+ else
+ {
+ ToXml_Negative(pStrm);
+ }
+}
+
+void XFNumberStyle::ToXml_StartElement(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+
+ pAttrList->AddAttribute( "style:family", "data-style" );
+
+ if( m_eType == enumXFNumberNumber )
+ {
+ pStrm->StartElement( "number:number-style" );
+ }
+ else if( m_eType == enumXFNumberPercent )
+ {
+ pStrm->StartElement( "number:percentage-style" );
+ }
+ else if( m_eType == enuMXFNumberCurrency )
+ {
+ pStrm->StartElement( "number:currency-style" );
+ }
+ else if( m_eType == enumXFNumberScientific )
+ {
+ pStrm->StartElement( "number:number-style" );
+ }
+ // for Text content number format
+ else if (m_eType == enumXFText)
+ {
+ pStrm->StartElement( "number:text-content");
+ }
+
+}
+
+void XFNumberStyle::ToXml_EndElement(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ pAttrList->AddAttribute( "style:family", "data-style" );
+
+ if( m_eType == enumXFNumberNumber )
+ {
+ pStrm->EndElement( "number:number-style" );
+ }
+ else if( m_eType == enumXFNumberPercent )
+ {
+ pStrm->EndElement( "number:percentage-style" );
+ }
+ else if( m_eType == enuMXFNumberCurrency )
+ {
+ pStrm->EndElement( "number:currency-style" );
+ }
+ else if( m_eType == enumXFNumberScientific )
+ {
+ pStrm->EndElement( "number:number-style" );
+ }
+ // for Text content number format
+ else if (m_eType == enumXFText)
+ {
+ pStrm->EndElement( "number:text-content");
+ }
+ // END for Text content number format
+
+}
+void XFNumberStyle::ToXml_Normal(IXFStream *pStrm)
+{
+ ToXml_StartElement(pStrm);
+
+ ToXml_Content(pStrm,false);
+
+ ToXml_EndElement(pStrm);
+}
+
+void XFNumberStyle::ToXml_Negative(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ OUString strStyleName = GetStyleName();
+ OUString strGEStyle = strStyleName + "PO";
+
+ SetStyleName(strGEStyle);
+ ToXml_Normal(pStrm);
+ SetStyleName(strStyleName);
+
+ ToXml_StartElement(pStrm);
+
+ ToXml_Content(pStrm,true);
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:condition", "value()>=0" );
+ pAttrList->AddAttribute( "style:apply-style-name", strGEStyle );
+ pStrm->StartElement( "style:map" );
+ pStrm->EndElement( "style:map" );
+
+ ToXml_EndElement(pStrm);
+}
+
+void XFNumberStyle::ToXml_Content(IXFStream *pStrm, bool nagetive)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ //color:
+ if( !nagetive )
+ pAttrList->AddAttribute( "fo:color", m_aColor.ToString() );
+ else
+ pAttrList->AddAttribute( "fo:color", m_aNegativeColor.ToString() );
+
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ if( !nagetive )
+ {
+ if( !m_strPrefix.isEmpty() )
+ {
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters(m_strPrefix);
+ pStrm->EndElement( "number:text" );
+ }
+ }
+ else
+ {
+ if( m_strNegativePrefix.isEmpty() )
+ m_strNegativePrefix = m_strPrefix;
+ if( !m_strNegativePrefix.isEmpty() )
+ {
+ pStrm->StartElement( "number:text" );
+ // pStrm->Characters(m_strNegativePrefix);
+ pStrm->Characters(m_strNegativePrefix + "-");
+ pStrm->EndElement( "number:text" );
+ }
+ else
+ {
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters("-");
+ pStrm->EndElement( "number:text" );
+ }
+ }
+
+ if( m_eType == enuMXFNumberCurrency )
+ {
+ if( !m_strCurrencySymbol.isEmpty() )
+ {
+ pStrm->StartElement( "number:currency-symbol" );
+ pStrm->Characters(m_strCurrencySymbol);
+ pStrm->EndElement( "number:currency-symbol" );
+ }
+ }
+
+ //When category of number format is scientific, the number can not be displayed normally in table.
+ if ( m_eType == enumXFNumberScientific )
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute("number:decimal-places", OUString::number(m_nDecimalDigits));
+ pAttrList->AddAttribute("number:min-integer-digits", OUString::number(1));
+ pAttrList->AddAttribute("number:min-exponent-digits", OUString::number(2));
+ pStrm->StartElement( "number:scientific-number" );
+ pStrm->EndElement( "number:scientific-number" );
+ }
+ else
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute("number:decimal-places", OUString::number(m_nDecimalDigits));
+ pAttrList->AddAttribute("number:min-integer-digits", OUString::number(1));
+
+ if( m_bGroup )
+ pAttrList->AddAttribute("number:grouping","true");
+ else
+ pAttrList->AddAttribute("number:grouping","false");
+
+ pStrm->StartElement( "number:number" );
+ pStrm->EndElement( "number:number" );
+ }
+
+ if( !nagetive )
+ {
+ if( !m_strSuffix.isEmpty() )
+ {
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters(m_strSuffix);
+ pStrm->EndElement( "number:text" );
+ }
+ else
+ {
+ if( m_eType == enumXFNumberPercent )
+ {
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters("%");
+ pStrm->EndElement( "number:text" );
+ }
+ }
+ }
+ else
+ {
+ if( m_strNegativeSuffix.isEmpty() )
+ m_strNegativeSuffix = m_strSuffix;
+ if( !m_strNegativeSuffix.isEmpty() )
+ {
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters(m_strNegativeSuffix);
+ pStrm->EndElement( "number:text" );
+ }
+ else
+ {
+ if( m_eType == enumXFNumberPercent )
+ {
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters("%");
+ pStrm->EndElement( "number:text" );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfofficemeta.cxx b/lotuswordpro/source/filter/xfilter/xfofficemeta.cxx
new file mode 100644
index 000000000..9867449bc
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfofficemeta.cxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Implementation file for Meta data,pls reference to the header file.
+ ************************************************************************/
+#include <xfilter/xfofficemeta.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+void XFOfficeMeta::SetCreator(const OUString& creator)
+{
+ m_strCreator = creator;
+}
+void XFOfficeMeta::SetDescription(const OUString& dsr)
+{
+ m_strDsr = dsr;
+}
+void XFOfficeMeta::SetKeywords(const OUString& keywords)
+{
+ m_strKeywords = keywords;
+}
+void XFOfficeMeta::SetCreationTime(const OUString& crtime)
+{
+ m_strCrtime = crtime;
+}
+void XFOfficeMeta::SetLastTime(const OUString& lstime)
+{
+ m_strLstime = lstime;
+}
+void XFOfficeMeta::SetEditTime(const OUString& edtime)
+{
+ m_strEdtime = edtime;
+}
+void XFOfficeMeta::ToXml(IXFStream *pStream)
+{
+ IXFAttrList *pAttrList = pStream->GetAttrList();
+
+ pAttrList->Clear();
+ pStream->StartElement( "office:meta" );
+
+ //generator:
+ pStream->StartElement( "meta:generator" );
+ pStream->Characters( m_strGenerator );
+ pStream->EndElement( "meta:generator" );
+
+ //title
+ pStream->StartElement( "dc:title" );
+ pStream->Characters( m_strTitle );
+ pStream->EndElement( "dc:title" );
+
+ //keywords
+ pStream->StartElement( "meta:keywords" );
+ pStream->StartElement( "meta:keyword" );
+ pStream->Characters( m_strKeywords );
+ pStream->EndElement( "meta:keyword" );
+ pStream->EndElement( "meta:keywords" );
+
+ //creation time
+ pStream->StartElement( "meta:creation-date" );
+ pStream->Characters( m_strCrtime);
+ pStream->EndElement( "meta:creation-date" );
+
+ //last revision time
+ pStream->StartElement( "dc:date" );
+ pStream->Characters( m_strLstime);
+ pStream->EndElement( "dc:date" );
+ //total edit time
+ pStream->StartElement( "meta:editing-duration" );
+ pStream->Characters( m_strEdtime);
+ pStream->EndElement( "meta:editing-duration" );
+
+ //description
+ pStream->StartElement( "dc:description" );
+ pStream->Characters( m_strDsr );
+ pStream->EndElement( "dc:description" );
+ //creator
+ pStream->StartElement( "meta:initial-creator" );
+ pStream->Characters( m_strCreator );
+ pStream->EndElement( "meta:initial-creator" );
+
+ pStream->EndElement( "office:meta" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx
new file mode 100644
index 000000000..d6419e1df
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Page master used bye XFMasterPage.
+ * It is the real object to define header and footer of pages.
+ ************************************************************************/
+#include <xfilter/xfpagemaster.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <xfilter/xfcolumns.hxx>
+#include <xfilter/xfheaderstyle.hxx>
+#include <xfilter/xffooterstyle.hxx>
+#include <xfilter/xfbgimage.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFPageMaster::XFPageMaster() : m_fPageWidth(0), m_fPageHeight(0), m_eUsage(enumXFPageUsageNone),
+m_eTextDir(enumXFTextDirNone),
+m_eSepAlign(enumXFAlignNone), m_fSepWidth(0), m_aSepColor(0), m_fSepSpaceAbove(0),
+m_fSepSpaceBelow(0), m_nSepLengthPercent(0)
+{
+}
+
+XFPageMaster::~XFPageMaster()
+{
+}
+
+enumXFStyle XFPageMaster::GetStyleFamily()
+{
+ return enumXFStylePageMaster;
+}
+
+void XFPageMaster::SetPageWidth(double width)
+{
+ m_fPageWidth = width;
+}
+
+void XFPageMaster::SetPageHeight(double height)
+{
+ m_fPageHeight = height;
+}
+
+void XFPageMaster::SetMargins(double left, double right,double top, double bottom)
+{
+ if( left != -1 )
+ m_aMargin.SetLeft(left);
+ if( right != -1 )
+ m_aMargin.SetRight(right);
+ if( top != -1 )
+ m_aMargin.SetTop(top);
+ if( bottom != -1 )
+ m_aMargin.SetBottom(bottom);
+}
+
+void XFPageMaster::SetBorders(std::unique_ptr<XFBorders> pBorders)
+{
+ m_pBorders = std::move( pBorders );
+}
+
+void XFPageMaster::SetShadow(XFShadow *pShadow)
+{
+ if( pShadow == m_pShadow.get() )
+ return;
+ m_pShadow.reset( pShadow );
+}
+
+void XFPageMaster::SetBackColor(XFColor color)
+{
+ m_aBackColor = color;
+}
+
+void XFPageMaster::SetBackImage(std::unique_ptr<XFBGImage>& rImage)
+{
+ m_pBGImage = std::move(rImage);
+}
+
+void XFPageMaster::SetColumns(XFColumns *pColumns)
+{
+ if( pColumns == m_pColumns.get() )
+ return;
+ m_pColumns.reset(pColumns);
+}
+
+ void XFPageMaster::SetHeaderStyle(XFHeaderStyle *pHeaderStyle)
+{
+ if( pHeaderStyle == m_pHeaderStyle.get() )
+ return;
+ m_pHeaderStyle.reset( pHeaderStyle );
+}
+
+void XFPageMaster::SetFooterStyle(XFFooterStyle *pFooterStyle)
+{
+ if( pFooterStyle == m_pFooterStyle.get() )
+ return;
+ m_pFooterStyle.reset( pFooterStyle );
+}
+
+void XFPageMaster::SetFootNoteSeparator(
+ enumXFAlignType align,
+ double width,
+ sal_Int32 lengthPercent,
+ double spaceAbove,
+ double spaceBelow,
+ XFColor color
+ )
+{
+ m_eSepAlign = align;
+ m_fSepWidth = width;
+ m_nSepLengthPercent = lengthPercent;
+ m_fSepSpaceAbove = spaceAbove;
+ m_fSepSpaceBelow = spaceBelow;
+ m_aSepColor = color;
+}
+
+/**
+ *
+ <style:page-master style:name="pm1">
+ <style:properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1"
+ style:print-orientation="portrait" fo:margin-top="1.249cm" fo:margin-bottom="1.249cm"
+ fo:margin-left="3.175cm" fo:margin-right="3.175cm" style:writing-mode="lr-tb"
+ style:layout-grid-color="#c0c0c0" style:layout-grid-lines="42"
+ style:layout-grid-base-height="0.494cm" style:layout-grid-ruby-height="0.141cm"
+ style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false"
+ style:layout-grid-display="false" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm"
+ style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:properties>
+ <style:header-style>
+ <style:properties fo:min-height="1.291cm" fo:margin-bottom="0.792cm" style:dynamic-spacing="true"/>
+ </style:header-style>
+ <style:footer-style>
+ <style:properties fo:min-height="1.291cm" fo:margin-top="0.792cm" style:dynamic-spacing="true"/>
+ </style:footer-style>
+ </style:page-master>
+
+ */
+void XFPageMaster::ToXml(IXFStream *pStream)
+{
+ IXFAttrList *pAttrList = pStream->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute("style:name",GetStyleName());
+
+ if( m_eUsage != enumXFPageUsageNone )
+ pAttrList->AddAttribute("style:page-usage", GetPageUsageName(m_eUsage));
+
+ pStream->StartElement( "style:page-master" );
+
+ //style:properties
+ pAttrList->Clear();
+ if( m_fPageWidth != 0 )
+ pAttrList->AddAttribute( "fo:page-width", OUString::number(m_fPageWidth) + "cm" );
+ if( m_fPageHeight != 0 )
+ pAttrList->AddAttribute( "fo:page-height", OUString::number(m_fPageHeight) + "cm" );
+
+ m_aMargin.ToXml(pStream);
+
+ pAttrList->AddAttribute( "style:print-orientation", "portrait" );
+
+ if( m_pBorders )
+ m_pBorders->ToXml(pStream);
+ if( m_pShadow )
+ pAttrList->AddAttribute( "style:shadow", m_pShadow->ToString() );
+
+ if( m_aBackColor.IsValid() )
+ pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
+
+ //text directory
+ if( m_eTextDir != enumXFTextDirNone )
+ pAttrList->AddAttribute( "style:writing-mode", GetTextDirName(m_eTextDir) );
+
+ pStream->StartElement( "style:properties" );
+ if( m_pColumns )
+ m_pColumns->ToXml(pStream);
+
+ if( m_pBGImage )
+ m_pBGImage->ToXml(pStream);
+
+ if( m_eSepAlign || m_nSepLengthPercent>0 || m_fSepSpaceAbove>0 || m_fSepSpaceBelow>0 )
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:width", OUString::number(m_fSepWidth) + "cm" );
+ pAttrList->AddAttribute( "style:distance-before-sep", OUString::number(m_fSepSpaceAbove) + "cm" );
+ pAttrList->AddAttribute( "style:distance-after-sep", OUString::number(m_fSepSpaceBelow) + "cm" );
+ pAttrList->AddAttribute( "style:color", m_aSepColor.ToString() );
+ if( m_eSepAlign == enumXFAlignStart )
+ pAttrList->AddAttribute( "style:adjustment", "left" );
+ else if( m_eSepAlign == enumXFAlignCenter )
+ pAttrList->AddAttribute( "style:adjustment", "center" );
+ else if( m_eSepAlign == enumXFAlignEnd )
+ pAttrList->AddAttribute( "style:adjustment", "right" );
+ pAttrList->AddAttribute( "style:rel-width", OUString::number(m_nSepLengthPercent) + "%" );
+ pStream->StartElement( "style:footnote-sep" );
+ pStream->EndElement( "style:footnote-sep" );
+ }
+
+ pStream->EndElement( "style:properties" );
+
+ //header style:
+ if( m_pHeaderStyle )
+ m_pHeaderStyle->ToXml(pStream);
+ //footer style:
+ if( m_pFooterStyle )
+ m_pFooterStyle->ToXml(pStream);
+
+ pStream->EndElement( "style:page-master" );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfparagraph.cxx b/lotuswordpro/source/filter/xfilter/xfparagraph.cxx
new file mode 100644
index 000000000..478513cbb
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfparagraph.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Paragraph object of OOo, it will output <text:p >...</text:p> element.
+ ************************************************************************/
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xftextcontent.hxx>
+
+XFParagraph::XFParagraph()
+{
+
+}
+
+XFParagraph::~XFParagraph()
+{
+}
+
+enumXFContent XFParagraph::GetContentType()
+{
+ return enumXFContentPara;
+}
+
+/**
+ * The paragraph object serial function,the output will be like:
+ * <text:p>
+ * <text:span text:style-name="T1">text content</text:span>
+ * text.
+ * <text:span text:style-name="T1">text content</text:span>
+ * </text:p>
+ */
+void XFParagraph::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ assert(pAttrList);
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+ pStrm->StartElement( "text:p" );
+
+ XFContentContainer::ToXml(pStrm);
+
+ pStrm->EndElement( "text:p" );
+}
+
+bool XFParagraph::HasContents() const
+{
+ return GetCount()>0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
new file mode 100644
index 000000000..4e298a248
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
@@ -0,0 +1,461 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Styles for paragraph.
+ * Styles for paragraph may include many style,include font,indent,margin,
+ * shadow,line height,and so on.
+ ************************************************************************/
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xfborders.hxx>
+#include "xftabstyle.hxx"
+#include <xfilter/xfbgimage.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFParaStyle::XFParaStyle()
+ : m_eAlignType(enumXFAlignNone)
+ , m_fTextIndent(0)
+ , m_nFlag(0)
+ , m_bNumberRight(false)
+{
+}
+
+
+XFParaStyle::XFParaStyle(const XFParaStyle& other)
+ : XFStyle(other)
+ , m_eAlignType(other.m_eAlignType)
+ , m_fTextIndent(other.m_fTextIndent)
+ , m_aBackColor(other.m_aBackColor)
+ , m_aMargin(other.m_aMargin)
+ , m_aPadding(other.m_aPadding)
+ , m_pFont(other.m_pFont)
+ , m_aShadow(other.m_aShadow)
+ , m_aDropcap(other.m_aDropcap)
+ , m_aLineHeight(other.m_aLineHeight)
+ , m_aBreaks(other.m_aBreaks)
+ , m_nFlag(other.m_nFlag)
+ , m_bNumberRight(other.m_bNumberRight)
+{
+ if( other.m_pBorders )
+ m_pBorders.reset( new XFBorders(*other.m_pBorders) );
+
+ if( other.m_pBGImage )
+ m_pBGImage.reset( new XFBGImage(*other.m_pBGImage) );
+
+ for (size_t i = 0; i < other.m_aTabs.GetCount(); ++i)
+ {
+ const IXFStyle* pStyle = other.m_aTabs.Item(i);
+ if( pStyle )
+ {
+ const XFTabStyle* pTabStyle = dynamic_cast<const XFTabStyle*>(pStyle);
+ if( pTabStyle )
+ {
+ std::unique_ptr<XFTabStyle> pCopyStyle(new XFTabStyle(*pTabStyle));
+ m_aTabs.AddStyle(std::move(pCopyStyle));
+ }
+ }
+ }
+}
+
+XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
+{
+ // Check for self-assignment
+ if (this != &other)
+ {
+ // first , clean member
+ m_pBGImage.reset();
+ m_aTabs.Reset();
+
+ m_strParentStyleName = other.m_strParentStyleName;
+ m_nFlag = other.m_nFlag;
+ m_eAlignType = other.m_eAlignType;
+ m_fTextIndent = other.m_fTextIndent;
+ m_bNumberRight = other.m_bNumberRight;
+
+ m_pFont = other.m_pFont;
+
+ if( other.m_pBorders )
+ m_pBorders.reset( new XFBorders(*other.m_pBorders) );
+ else
+ m_pBorders.reset();
+ m_aBackColor = other.m_aBackColor;
+ if( other.m_pBGImage )
+ m_pBGImage.reset( new XFBGImage(*other.m_pBGImage) );
+ else
+ m_pBGImage.reset();
+
+ m_aShadow = other.m_aShadow;
+ m_aMargin = other.m_aMargin;
+ m_aDropcap = other.m_aDropcap;
+ m_aLineHeight = other.m_aLineHeight;
+ m_aPadding = other.m_aPadding;
+ m_aBreaks = other.m_aBreaks;
+
+ for (size_t i=0; i<other.m_aTabs.GetCount(); ++i)
+ {
+ const IXFStyle *pStyle = other.m_aTabs.Item(i);
+ if( pStyle )
+ {
+ const XFTabStyle *pTabStyle = dynamic_cast<const XFTabStyle*>(pStyle);
+ if( pTabStyle )
+ {
+ std::unique_ptr<XFTabStyle> pCopyStyle(new XFTabStyle(*pTabStyle));
+ m_aTabs.AddStyle(std::move(pCopyStyle));
+ }
+ }
+ }
+ }
+ return *this;
+}
+
+XFParaStyle::~XFParaStyle()
+{
+}
+
+enumXFStyle XFParaStyle::GetStyleFamily()
+{
+ return enumXFStylePara;
+}
+
+void XFParaStyle::SetFont(rtl::Reference<XFFont> const & pFont)
+{
+ m_pFont = pFont;
+}
+
+void XFParaStyle::SetIndent(double indent )
+{
+ m_fTextIndent = indent;
+}
+
+void XFParaStyle::SetMargins(double left, double right, double top, double bottom)
+{
+ if( left != -1 )
+ m_aMargin.SetLeft(left);
+ if( right != -1 )
+ m_aMargin.SetRight(right);
+ if( top != -1 )
+ m_aMargin.SetTop(top);
+ if( bottom != -1 )
+ m_aMargin.SetBottom( bottom );
+}
+
+void XFParaStyle::SetShadow(enumXFShadowPos pos, double offset, XFColor const & color)
+{
+ m_aShadow.SetPosition(pos);
+ m_aShadow.SetOffset(offset);
+ m_aShadow.SetColor(color);
+}
+
+void XFParaStyle::SetBackColor(XFColor const & color)
+{
+ m_aBackColor = color;
+ m_nFlag |= XFPARA_FLAG_BACKCOLOR;
+}
+
+void XFParaStyle::SetBackImage(std::unique_ptr<XFBGImage>& rImage)
+{
+ m_pBGImage = std::move(rImage);
+}
+
+void XFParaStyle::SetBorders(XFBorders *pBorders)
+{
+ m_pBorders.reset( pBorders );
+}
+
+void XFParaStyle::SetDropCap(sal_Int16 nLength,
+ sal_Int16 nLines,
+ double fDistance
+ )
+{
+ assert(nLength>=1);
+ assert(nLines>=2);
+ assert(fDistance>=0);
+
+ m_aDropcap.SetCharCount(nLength);
+ m_aDropcap.SetLines(nLines);
+ m_aDropcap.SetDistance(fDistance);
+}
+
+void XFParaStyle::SetLineHeight(enumLHType type, double value)
+{
+ if( type == enumLHNone )
+ {
+ return;
+ }
+ switch(type)
+ {
+ case enumLHHeight:
+ m_aLineHeight.SetHeight(value) ;
+ break;
+ case enumLHLeast:
+ m_aLineHeight.SetLeastHeight(value);
+ break;
+ case enumLHPercent: //perhaps i should redesign the interface here,ohm...
+ m_aLineHeight.SetPercent(static_cast<sal_Int32>(value));
+ break;
+ case enumLHSpace:
+ m_aLineHeight.SetSpace(value*0.5666); //don't known why,just suspect.
+ break;
+ default:
+ break;
+ }
+}
+
+void XFParaStyle::AddTabStyle(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter)
+{
+ std::unique_ptr<XFTabStyle> tab(new XFTabStyle());
+ tab->SetTabType(type);
+ tab->SetLength(len);
+ tab->SetLeaderChar(leader);
+ tab->SetDelimiter(delimiter);
+ m_aTabs.AddStyle(std::move(tab));
+}
+
+/**
+ *Affirm whether two XFParaStyle objects are equal.
+ */
+bool XFParaStyle::Equal(IXFStyle *pStyle)
+{
+ if( this == pStyle )
+ return true;
+ if( !pStyle || pStyle->GetStyleFamily() != enumXFStylePara )
+ return false;
+
+ XFParaStyle *pOther = static_cast<XFParaStyle*>(pStyle);
+
+ if( m_nFlag != pOther->m_nFlag )
+ return false;
+ if( m_strParentStyleName != pOther->m_strParentStyleName )
+ return false;
+ if( m_strMasterPage != pOther->m_strMasterPage )
+ return false;
+ if( m_fTextIndent != pOther->m_fTextIndent )
+ return false;
+ //align:
+ if( m_eAlignType != pOther->m_eAlignType )
+ return false;
+
+ //shadow:
+ if( m_aShadow != pOther->m_aShadow )
+ return false;
+ //margin:
+ if( m_aMargin != pOther->m_aMargin )
+ return false;
+
+ if( m_aPadding != pOther->m_aPadding )
+ return false;
+
+ //dropcap:
+ if( m_aDropcap != pOther->m_aDropcap )
+ return false;
+ //line height:
+ if( m_aLineHeight != pOther->m_aLineHeight )
+ return false;
+ //breaks:
+ if( m_aBreaks != pOther->m_aBreaks )
+ return false;
+ if( m_aTabs != pOther->m_aTabs )
+ return false;
+
+ //font:
+ if( m_pFont.is() )
+ {
+ if( !pOther->m_pFont.is() )
+ return false;
+ if(*m_pFont != *pOther->m_pFont )
+ return false;
+ }
+ else if( pOther->m_pFont.is() )
+ return false;
+
+ //border:
+ if( m_pBorders )
+ {
+ if( !pOther->m_pBorders )
+ return false;
+ if( *m_pBorders != *pOther->m_pBorders )
+ return false;
+ }
+ else if( pOther->m_pBorders )
+ return false;
+
+ if( m_pBGImage )
+ {
+ if( !pOther->m_pBGImage )
+ return false;
+ if( *m_pBGImage != *pOther->m_pBGImage )
+ return false;
+ }
+ else if( pOther->m_pBGImage )
+ return false;//add end
+
+ //number right
+ if ( m_bNumberRight != pOther->m_bNumberRight)
+ return false;
+
+ return true;
+}
+
+void XFParaStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ OUString style = GetStyleName();
+
+ pAttrList->Clear();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute("style:name",GetStyleName());
+ pAttrList->AddAttribute("style:family", "paragraph");
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+
+ if( !m_strMasterPage.isEmpty() )
+ pAttrList->AddAttribute("style:master-page-name",m_strMasterPage);
+ pStrm->StartElement("style:style");
+
+ //Paragraph properties:
+ pAttrList->Clear();
+
+ //text indent:
+ if( m_fTextIndent )
+ {
+ pAttrList->AddAttribute("fo:text-indent", OUString::number(m_fTextIndent) + "cm" );
+ }
+ //padding:
+ m_aPadding.ToXml(pStrm);
+ //margin:
+ m_aMargin.ToXml(pStrm);
+
+ //text align:
+ if( m_eAlignType != enumXFAlignNone )
+ {
+ pAttrList->AddAttribute("fo:text-align", GetAlignName(m_eAlignType) );
+ }
+ //line number:
+ pAttrList->AddAttribute( "text:number-lines", "true" );
+ pAttrList->AddAttribute( "text:line-number", OUString::number(0) );
+
+ //shadow:
+ m_aShadow.ToXml(pStrm);
+ //borders:
+ if( m_pBorders )
+ m_pBorders->ToXml(pStrm);
+ //line height:
+ m_aLineHeight.ToXml(pStrm);
+
+ //background color:
+ if( m_nFlag&XFPARA_FLAG_BACKCOLOR && m_aBackColor.IsValid() )
+ {
+ pAttrList->AddAttribute("fo:background-color", m_aBackColor.ToString() );
+ }
+ //Font properties:
+ if( m_pFont.is() )
+ m_pFont->ToXml(pStrm);
+
+ //page breaks:
+ m_aBreaks.ToXml(pStrm);
+
+ pStrm->StartElement("style:properties");
+
+ //dropcap:
+ m_aDropcap.ToXml(pStrm);
+
+ //tabs:
+ if( m_aTabs.GetCount() > 0 )
+ {
+ pAttrList->Clear();
+ pStrm->StartElement( "style:tab-stops" );
+ m_aTabs.ToXml(pStrm);
+ pStrm->EndElement( "style:tab-stops" );
+ }
+
+ //background color:
+ if( m_pBGImage )
+ m_pBGImage->ToXml(pStrm);
+
+ pStrm->EndElement("style:properties");
+
+ pStrm->EndElement("style:style");
+}
+
+XFDefaultParaStyle::XFDefaultParaStyle()
+{
+ m_fTabDistance = 1.28;
+}
+
+enumXFStyle XFDefaultParaStyle::GetStyleFamily()
+{
+ return enumXFStyleDefaultPara;
+}
+
+void XFDefaultParaStyle::ToXml(IXFStream * pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pAttrList->AddAttribute("style:family", "paragraph");
+ pStrm->StartElement("style:default-style");
+
+ //Paragraph properties:
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute("style:tab-stop-distance", OUString::number(m_fTabDistance) + "cm" );
+
+ pStrm->StartElement("style:properties");
+ pStrm->EndElement("style:properties");
+ pStrm->EndElement("style:default-style");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfrow.cxx b/lotuswordpro/source/filter/xfilter/xfrow.cxx
new file mode 100644
index 000000000..85a129731
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfrow.cxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table object.
+ ************************************************************************/
+
+#include <sal/config.h>
+
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xfrow.hxx>
+#include <xfilter/xfcell.hxx>
+#include <xfilter/xftable.hxx>
+
+XFRow::XFRow()
+ : m_pOwnerTable(nullptr)
+ , m_nRepeat(0)
+ , m_nRow(0)
+{
+}
+
+XFRow::~XFRow()
+{
+}
+
+void XFRow::AddCell(rtl::Reference<XFCell> const & rCell)
+{
+ if (!rCell)
+ return;
+ sal_Int32 col = m_aCells.size()+1;
+ rCell->SetCol(col);
+ rCell->SetOwnerRow(this);
+ m_aCells[col] = rCell;
+}
+
+sal_Int32 XFRow::GetCellCount() const
+{
+ return m_aCells.size();
+}
+
+XFCell* XFRow::GetCell(sal_Int32 col) const
+{
+ if( m_aCells.find(col) == m_aCells.end() )
+ return nullptr;
+ else
+ return m_aCells.find(col)->second.get();
+}
+
+void XFRow::ToXml(IXFStream *pStrm)
+{
+ sal_Int32 lastCol = 0;
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "table:style-name", GetStyleName() );
+ if( m_nRepeat )
+ pAttrList->AddAttribute( "table:number-rows-repeated", OUString::number(m_nRepeat) );
+ pStrm->StartElement( "table:table-row" );
+
+ for (auto const& cell : m_aCells)
+ {
+ int col = cell.first;
+ XFCell *pCell = cell.second.get();
+ if( !pCell )
+ continue;
+ if( col>lastCol+1 )
+ {
+ XFCell *pNULLCell = new XFCell();
+ if( col>lastCol+2 )
+ pNULLCell->SetRepeated(col-lastCol-1);
+ pNULLCell->ToXml(pStrm);
+ }
+ pCell->ToXml(pStrm);
+ lastCol = col;
+ }
+
+ pStrm->EndElement( "table:table-row" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx
new file mode 100644
index 000000000..3a1982853
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table row style, ie. table row height.
+ ************************************************************************/
+#include <xfilter/xfrowstyle.hxx>
+#include <xfilter/xfbgimage.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFRowStyle::XFRowStyle():m_fHeight(0)
+{
+ m_fHeight = 0;
+ m_fMinHeight = 0;
+}
+
+enumXFStyle XFRowStyle::GetStyleFamily()
+{
+ return enumXFStyleTableRow;
+}
+
+void XFRowStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+
+ pAttrList->AddAttribute( "style:family", "table-row" );
+ pStrm->StartElement( "style:style" );
+
+ pAttrList->Clear();
+ if( m_fMinHeight )
+ pAttrList->AddAttribute( "style:min-row-height", OUString::number(m_fMinHeight) + "cm" );
+ else if( m_fHeight )
+ pAttrList->AddAttribute( "style:row-height", OUString::number(m_fHeight) + "cm" );
+
+ if( m_aBackColor.IsValid() )
+ pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx
new file mode 100644
index 000000000..5bd78fb82
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Document object of the xml filter framework.
+ ************************************************************************/
+#include "xfsaxattrlist.hxx"
+#include <xmloff/attrlist.hxx>
+
+XFSaxAttrList::XFSaxAttrList() : m_xSvAttrList(new SvXMLAttributeList())
+{
+}
+
+XFSaxAttrList::~XFSaxAttrList()
+{
+}
+
+void XFSaxAttrList::AddAttribute(const OUString& name, const OUString& value)
+{
+ m_xSvAttrList->AddAttribute(name,value);
+}
+
+void XFSaxAttrList::Clear()
+{
+ m_xSvAttrList->Clear();
+}
+
+css::uno::Reference<css::xml::sax::XAttributeList> XFSaxAttrList::GetAttributeList() const
+{
+ return m_xSvAttrList.get();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx
new file mode 100644
index 000000000..74db79e9b
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Wrapper the attribute list of a xml element.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFSAXATTRLIST_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFSAXATTRLIST_HXX
+
+#include <xfilter/ixfattrlist.hxx>
+#include <rtl/ref.hxx>
+#include <xmloff/attrlist.hxx>
+
+class XFSaxAttrList : public IXFAttrList
+{
+public:
+ XFSaxAttrList();
+
+ virtual ~XFSaxAttrList() override;
+
+public:
+ //Interface ISaxAttributeList:
+ virtual void AddAttribute(const OUString& name, const OUString& value) override;
+
+ virtual void Clear() override;
+
+ css::uno::Reference<css::xml::sax::XAttributeList> GetAttributeList() const;
+
+ friend class XFSaxStream;
+private:
+ rtl::Reference<SvXMLAttributeList> m_xSvAttrList;
+
+};
+
+#endif //XFSAXATTRLIST_INC
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
new file mode 100644
index 000000000..4f667ae3a
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tool for sax writer.
+ ************************************************************************/
+#include <xfilter/xfsaxstream.hxx>
+#include "xfsaxattrlist.hxx"
+
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+
+using namespace ::cppu;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+
+XFSaxStream::XFSaxStream(Reference<XDocumentHandler> const & xHandler)
+{
+ m_aHandler = xHandler;
+ m_pAttrList.reset(new XFSaxAttrList );
+}
+
+XFSaxStream::~XFSaxStream()
+{
+}
+
+void XFSaxStream::StartDocument()
+{
+ if (m_aHandler.is())
+ m_aHandler->startDocument();
+}
+
+void XFSaxStream::EndDocument()
+{
+ if (m_aHandler.is())
+ m_aHandler->endDocument();
+}
+
+void XFSaxStream::StartElement(const OUString& oustr)
+{
+ if (m_aHandler.is())
+ m_aHandler->startElement( oustr, m_pAttrList->GetAttributeList() );
+ m_pAttrList->Clear();
+}
+
+void XFSaxStream::EndElement(const OUString& oustr)
+{
+ if (m_aHandler.is())
+ m_aHandler->endElement(oustr);
+
+ if( m_pAttrList )
+ m_pAttrList->Clear();
+}
+
+void XFSaxStream::Characters(const OUString& oustr)
+{
+ if (m_aHandler.is())
+ m_aHandler->characters(oustr);
+}
+
+IXFAttrList* XFSaxStream::GetAttrList()
+{
+ return m_pAttrList.get();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfsection.cxx b/lotuswordpro/source/filter/xfilter/xfsection.cxx
new file mode 100644
index 000000000..dd503bb68
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfsection.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Section object.
+ ************************************************************************/
+#include <xfilter/xfsection.hxx>
+#include <xfilter/xfglobal.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFSection::XFSection()
+{
+ m_strSectionName = XFGlobal::GenSectionName();
+}
+
+XFSection::~XFSection()
+{
+}
+
+void XFSection::ToXml(IXFStream *pStrm)
+{
+ assert(!m_strSectionName.isEmpty() );
+
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ OUString style = GetStyleName();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", style);
+ //section name
+ if( !m_strSectionName.isEmpty() )
+ pAttrList->AddAttribute( "text:name", m_strSectionName);
+
+ pStrm->StartElement( "text:section" );
+ if( !m_strSourceLink.isEmpty() )
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "xlink:href", m_strSourceLink);
+ pAttrList->AddAttribute( "text:filter-name", "wordpro");
+ pStrm->StartElement( "text:section-source" );
+ pStrm->EndElement( "text:section-source" );
+ }
+
+ XFContentContainer::ToXml(pStrm);
+
+ pStrm->EndElement( "text:section" );
+
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx b/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx
new file mode 100644
index 000000000..0bf664d6a
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Section style,whose family is "section"
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfsectionstyle.hxx>
+#include <xfilter/xfcolumns.hxx>
+
+XFSectionStyle::XFSectionStyle()
+{
+ m_fMarginLeft = 0;
+ m_fMarginRight = 0;
+ m_pColumns = nullptr;
+}
+
+XFSectionStyle::~XFSectionStyle()
+{
+}
+
+enumXFStyle XFSectionStyle::GetStyleFamily()
+{
+ return enumXFStyleSection;
+}
+
+void XFSectionStyle::SetMarginLeft(double left)
+{
+ m_fMarginLeft = left;
+}
+
+void XFSectionStyle::SetMarginRight(double right)
+{
+ m_fMarginRight = right;
+}
+
+void XFSectionStyle::SetColumns(XFColumns *pColumns)
+{
+ m_pColumns.reset( pColumns );
+}
+
+void XFSectionStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ pAttrList->AddAttribute( "style:family", "section" );
+
+ pStrm->StartElement( "style:style" );
+
+ pAttrList->Clear();
+ if( m_fMarginLeft != 0 )
+ {
+ pAttrList->AddAttribute( "fo:margin-left", OUString::number(m_fMarginLeft) + "cm" );
+ }
+ if( m_fMarginRight != 0 )
+ {
+ pAttrList->AddAttribute( "fo:margin-right", OUString::number(m_fMarginRight) + "cm" );
+ }
+ if( m_aBackColor.IsValid() )
+ {
+ pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
+ }
+ else
+ {
+ pAttrList->AddAttribute( "fo:background-color", "transparent" );
+ }
+
+ pStrm->StartElement( "style:properties" );
+
+ if( m_pColumns )
+ m_pColumns->ToXml(pStrm);
+
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfshadow.cxx b/lotuswordpro/source/filter/xfilter/xfshadow.cxx
new file mode 100644
index 000000000..a5acfb343
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfshadow.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Shadow object,now only used by paragraph object.
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xfshadow.hxx>
+
+XFShadow::XFShadow()
+ : m_ePosition(enumXFShadowNone)
+ , m_fOffset(0.18)
+ , m_aColor(128,128,0)
+{}
+
+OUString XFShadow::ToString()
+{
+ OUString buf;
+ OUString strOff = OUString::number(m_fOffset);
+
+ switch(m_ePosition)
+ {
+ case enumXFShadowRightBottom:
+ buf = m_aColor.ToString() + " " + strOff + "cm " + strOff + "cm";
+ break;
+ case enumXFShadowRightTop:
+ buf = m_aColor.ToString() + " " + strOff + "cm -" + strOff + "cm";
+ break;
+ case enumXFShadowLeftBottom:
+ buf = m_aColor.ToString() + " -" + strOff + "cm " + strOff + "cm";
+ break;
+ case enumXFShadowLeftTop:
+ buf = m_aColor.ToString() + " -" + strOff + "cm -" + strOff + "cm";
+ break;
+ default:
+ buf = m_aColor.ToString();
+ break;
+ }
+
+ return buf;
+}
+
+void XFShadow::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ if( m_ePosition == enumXFShadowNone )
+ return;
+ else
+ pAttrList->AddAttribute( "style:shadow", ToString() );
+}
+
+bool operator==(XFShadow const & s1, XFShadow const & s2)
+{
+ return (s1.m_ePosition == s2.m_ePosition) &&
+ (s1.m_fOffset == s2.m_fOffset) &&
+ (s1.m_aColor == s2.m_aColor);
+}
+
+bool operator!=(XFShadow const & s1, XFShadow const & s2)
+{
+ return !(s1==s2);
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfstyle.cxx b/lotuswordpro/source/filter/xfilter/xfstyle.cxx
new file mode 100644
index 000000000..d6846340e
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfstyle.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Base style object .
+ ************************************************************************/
+#include <xfilter/xfstyle.hxx>
+
+XFStyle::XFStyle()
+{
+}
+
+XFStyle::~XFStyle()
+{
+}
+
+OUString XFStyle::GetStyleName()
+{
+ return m_strStyleName;
+}
+
+void XFStyle::SetStyleName(const OUString& styleName)
+{
+ m_strStyleName = styleName;
+}
+
+OUString XFStyle::GetParentStyleName()
+{
+ return m_strParentStyleName;
+}
+
+void XFStyle::SetParentStyleName(const OUString& styleName)
+{
+ m_strParentStyleName = styleName;
+}
+
+enumXFStyle XFStyle::GetStyleFamily()
+{
+ return enumXFStyleUnknown;
+}
+
+bool XFStyle::Equal(IXFStyle * /*pStyle*/)
+{
+ return false;
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfstylecont.cxx b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
new file mode 100644
index 000000000..2d8f9139a
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
@@ -0,0 +1,251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Font object to serial to xml filter.
+ ************************************************************************/
+#include <xfilter/xfstylecont.hxx>
+#include <xfilter/ixfstyle.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xffontfactory.hxx>
+#include <lwpglobalmgr.hxx>
+
+XFStyleContainer::XFStyleContainer(const OUString& strStyleNamePrefix)
+ :m_strStyleNamePrefix(strStyleNamePrefix)
+{
+}
+
+XFStyleContainer::~XFStyleContainer()
+{
+}
+
+void XFStyleContainer::Reset()
+{
+ m_aStyles.clear();
+}
+
+IXFStyleRet XFStyleContainer::AddStyle(std::unique_ptr<IXFStyle> pStyle)
+{
+ IXFStyleRet aRet;
+
+ IXFStyle *pConStyle = nullptr;
+ OUString name;
+
+ if( !pStyle )
+ return aRet;
+ //no matter we want to delete the style or not,XFFont object should be saved first.
+ ManageStyleFont(pStyle.get());
+
+ if( pStyle->GetStyleName().isEmpty() )
+ pConStyle = FindSameStyle(pStyle.get());
+
+ if( pConStyle )//such a style has exist:
+ {
+ aRet.m_pStyle = pConStyle;
+ aRet.m_bOrigDeleted = true;
+ return aRet;
+ }
+ else
+ {
+ if( pStyle->GetStyleName().isEmpty() )
+ {
+ name = m_strStyleNamePrefix + OUString::number(m_aStyles.size()+1);
+ pStyle->SetStyleName(name);
+ }
+ else
+ {
+ name = pStyle->GetStyleName();
+ //for name conflict
+ if(FindStyle( name))
+ {
+ name += OUString::number(m_aStyles.size()+1);
+ pStyle->SetStyleName(name);
+ }
+ }
+
+ //transform the font object to XFFontFactory
+ aRet.m_pStyle = pStyle.get();
+ m_aStyles.push_back(std::move(pStyle));
+ return aRet;
+ }
+}
+
+IXFStyle* XFStyleContainer::FindSameStyle(IXFStyle *pStyle)
+{
+ for (auto const& style : m_aStyles)
+ {
+ assert(style);
+ if( style->Equal(pStyle) )
+ return style.get();
+ }
+
+ return nullptr;
+}
+
+IXFStyle* XFStyleContainer::FindStyle(const OUString& name)
+{
+ for (auto const& style : m_aStyles)
+ {
+ assert(style);
+ if( style->GetStyleName() == name )
+ return style.get();
+ }
+
+ return nullptr;
+}
+
+const IXFStyle* XFStyleContainer::Item(size_t index) const
+{
+ assert(index<m_aStyles.size());
+ if (index < m_aStyles.size())
+ {
+ return m_aStyles[index].get();
+ }
+ return nullptr;
+}
+
+void XFStyleContainer::ToXml(IXFStream *pStrm)
+{
+ for (auto const& style : m_aStyles)
+ {
+ assert(style);
+ style->ToXml(pStrm);
+ }
+}
+
+void XFStyleContainer::ManageStyleFont(IXFStyle *pStyle)
+{
+ rtl::Reference<XFFont> pStyleFont;
+ rtl::Reference<XFFont> pFactoryFont;
+
+ if( !pStyle )
+ return;
+
+ if( pStyle->GetStyleFamily() == enumXFStyleText )
+ {
+ XFTextStyle *pTS = static_cast<XFTextStyle*>(pStyle);
+ pStyleFont = pTS->GetFont();
+ if( !pStyleFont.is() )
+ return;
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ XFFontFactory* pFontFactory = pGlobal->GetXFFontFactory();
+ pFactoryFont = pFontFactory->FindSameFont(pStyleFont);
+ //this font has been exists in the factory:
+ if( pFactoryFont.is() )
+ {
+ pTS->SetFont(pFactoryFont);
+ }
+ else
+ {
+ pFontFactory->AddFont(pStyleFont);
+ }
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStylePara )
+ {
+ XFParaStyle *pPS = static_cast<XFParaStyle*>(pStyle);
+ pStyleFont = pPS->GetFont();
+ if( !pStyleFont.is() )
+ return;
+ LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
+ XFFontFactory* pFontFactory = pGlobal->GetXFFontFactory();
+ pFactoryFont = pFontFactory->FindSameFont(pStyleFont);
+ //this font has been exists in the factory:
+ if( pFactoryFont.is() )
+ {
+ pPS->SetFont(pFactoryFont);
+ }
+ else
+ {
+ pFontFactory->AddFont(pStyleFont);
+ }
+ }
+}
+
+bool operator==(XFStyleContainer& b1, XFStyleContainer& b2)
+{
+ if( b1.m_strStyleNamePrefix != b2.m_strStyleNamePrefix )
+ return false;
+ if( b1.m_aStyles.size() != b2.m_aStyles.size() )
+ return false;
+ for( size_t i=0; i<b1.m_aStyles.size(); ++i )
+ {
+ IXFStyle *pS1 = b1.m_aStyles[i].get();
+ IXFStyle *pS2 = b2.m_aStyles[i].get();
+
+ if( pS1 )
+ {
+ if( !pS2 )
+ return false;
+ if( !pS1->Equal(pS2) )
+ return false;
+ }
+ else
+ {
+ if( pS2 )
+ return false;
+ }
+ }
+ return true;
+}
+
+bool operator!=(XFStyleContainer& b1, XFStyleContainer& b2)
+{
+ return !(b1==b2);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
new file mode 100644
index 000000000..34ddb7d09
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
@@ -0,0 +1,375 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style manager for the filter.
+ ************************************************************************/
+
+#include <sal/config.h>
+
+#include <xfilter/xfparastyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/ixfstyle.hxx>
+
+XFStyleManager::XFStyleManager() : s_aStdArrowStyles( "arrow" ), s_aTextStyles( "T" ),
+ s_aParaStyles( "P" ),s_aListStyles( "L" ),s_aSectionStyles( "Sect" ),
+ s_aPageMasters( "PM" ),s_aMasterpages( "MP" ),s_aDateStyles( "N" ),
+ s_aGraphicsStyles( "fr" ),s_aTableStyles( "table" ),s_aTableCellStyles( "cell" ),
+ s_aTableRowStyles( "row" ),s_aTableColStyles( "col" )
+{
+}
+
+XFStyleManager::~XFStyleManager()
+{
+ Reset();
+}
+
+void XFStyleManager::Reset()
+{
+ s_pOutlineStyle.reset();
+
+ s_aStdTextStyles.Reset();
+ s_aStdParaStyles.Reset();
+ s_aStdStrokeDashStyles.Reset();
+ s_aStdAreaStyles.Reset();
+ s_aStdArrowStyles.Reset();
+ s_aTextStyles.Reset();
+ s_aParaStyles.Reset();
+ s_aListStyles.Reset();
+ s_aSectionStyles.Reset();
+ s_aPageMasters.Reset();
+ s_aMasterpages.Reset();
+ s_aDateStyles.Reset();
+ s_aGraphicsStyles.Reset();
+ s_aConfigManager.Reset();
+ //must clear all static containers.
+ s_aFontDecls.clear();
+}
+
+void XFStyleManager::AddFontDecl(XFFontDecl const & aFontDecl)
+{
+ s_aFontDecls.push_back(aFontDecl);
+}
+
+IXFStyleRet XFStyleManager::AddStyle(std::unique_ptr<IXFStyle> pStyle)
+{
+ IXFStyleRet aRet;
+
+ assert(pStyle);
+ OUString name = pStyle->GetStyleName();
+
+ if( pStyle->GetStyleFamily() == enumXFStyleText )
+ {
+ if( !name.isEmpty() )
+ {
+ aRet = s_aStdTextStyles.AddStyle(std::move(pStyle));
+ }
+ else
+ {
+ aRet = s_aTextStyles.AddStyle(std::move(pStyle));
+ }
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStylePara )
+ {
+ if( !name.isEmpty() )
+ {
+ aRet = s_aStdParaStyles.AddStyle(std::move(pStyle));
+ }
+ else
+ {
+ aRet = s_aParaStyles.AddStyle(std::move(pStyle));
+ }
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleDefaultPara )
+ {
+ aRet = s_aStdParaStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleList )
+ {
+ aRet = s_aListStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleSection )
+ {
+ aRet = s_aSectionStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStylePageMaster )
+ {
+ aRet = s_aPageMasters.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleMasterPage )
+ {
+ //Master page don't need name.
+ aRet = s_aMasterpages.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleDate )
+ {
+ aRet = s_aDateStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleTime )
+ {
+ aRet = s_aDateStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleNumber )
+ {
+ aRet = s_aDateStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStylePercent )
+ {
+ aRet = s_aDateStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleCurrency )
+ {
+ aRet = s_aDateStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleGraphics )
+ {
+ aRet = s_aGraphicsStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleTable )
+ {
+ aRet = s_aTableStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleTableCell )
+ {
+ aRet = s_aTableCellStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleTableRow )
+ {
+ aRet = s_aTableRowStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleTableCol )
+ {
+ aRet = s_aTableColStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleOutline )
+ {
+ s_pOutlineStyle = std::move(pStyle);
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleStrokeDash )
+ {
+ aRet = s_aStdStrokeDashStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleArea )
+ {
+ aRet = s_aStdAreaStyles.AddStyle(std::move(pStyle));
+ }
+ else if( pStyle->GetStyleFamily() == enumXFStyleArrow )
+ {
+ aRet = s_aStdArrowStyles.AddStyle(std::move(pStyle));
+ }
+ else if (pStyle->GetStyleFamily() == enumXFStyleRuby)
+ {
+ aRet = s_aRubyStyles.AddStyle(std::move(pStyle));
+ }
+
+ return aRet;
+}
+
+IXFStyle* XFStyleManager::FindStyle(const OUString& name)
+{
+ IXFStyle *pStyle = FindParaStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = FindTextStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aListStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aSectionStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aPageMasters.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aMasterpages.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aDateStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aGraphicsStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aTableStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aTableCellStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aTableRowStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aTableColStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ if(s_pOutlineStyle && s_pOutlineStyle->GetStyleName() == name )
+ return s_pOutlineStyle.get();
+ pStyle = s_aStdStrokeDashStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aStdAreaStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+ pStyle = s_aStdArrowStyles.FindStyle(name);
+ if( pStyle )
+ return pStyle;
+
+ return nullptr;
+}
+
+XFParaStyle* XFStyleManager::FindParaStyle(const OUString& name)
+{
+ IXFStyle *pStyle = s_aParaStyles.FindStyle(name);
+ if( pStyle )
+ return static_cast<XFParaStyle*>(pStyle);
+ else
+ return static_cast<XFParaStyle*>(s_aStdParaStyles.FindStyle(name));
+}
+
+XFTextStyle* XFStyleManager::FindTextStyle(const OUString& name)
+{
+ IXFStyle *pStyle = s_aTextStyles.FindStyle(name);
+ if( pStyle )
+ return static_cast<XFTextStyle*>(pStyle);
+ else
+ return static_cast<XFTextStyle*>(s_aStdTextStyles.FindStyle(name));
+}
+
+void XFStyleManager::SetLineNumberConfig(XFLineNumberConfig *pLNConf)
+{
+ s_aConfigManager.SetLineNumberConfig(pLNConf);
+}
+
+void XFStyleManager::SetFootnoteConfig(XFFootnoteConfig *pFNConfig)
+{
+ s_aConfigManager.SetFootnoteConfig(pFNConfig);
+}
+
+void XFStyleManager::SetEndnoteConfig(XFEndnoteConfig *pENConfig)
+{
+ s_aConfigManager.SetEndnoteConfig(pENConfig);
+}
+
+void XFStyleManager::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pStrm->StartElement( "office:font-decls" );
+
+ //font declarations:
+ for (const auto & fontDecl : s_aFontDecls)
+ {
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", fontDecl.GetFontName() );
+ pAttrList->AddAttribute( "fo:font-family", fontDecl.GetFontFamily() );
+ pAttrList->AddAttribute( "style:font-pitch", "variable" );
+ pStrm->StartElement( "style:font-decl" );
+ pStrm->EndElement( "style:font-decl" );
+ }
+
+ pStrm->EndElement( "office:font-decls" );
+
+ //office:styles:
+ pAttrList->Clear();
+ pStrm->StartElement( "office:styles" );
+
+ s_aStdParaStyles.ToXml(pStrm);
+ s_aStdTextStyles.ToXml(pStrm);
+ s_aStdStrokeDashStyles.ToXml(pStrm);
+ s_aStdAreaStyles.ToXml(pStrm);
+ s_aStdArrowStyles.ToXml(pStrm);
+ //date,time styles:
+ s_aDateStyles.ToXml(pStrm);
+ s_aConfigManager.ToXml(pStrm);
+ //for optimist.
+ s_aListStyles.ToXml(pStrm);
+
+ if( s_pOutlineStyle )
+ s_pOutlineStyle->ToXml(pStrm);
+
+ pStrm->EndElement( "office:styles" );
+
+ //automatic styles:
+ pAttrList->Clear();
+ pStrm->StartElement( "office:automatic-styles" );
+
+ s_aTableStyles.ToXml(pStrm);
+ s_aTableCellStyles.ToXml(pStrm);
+ s_aTableRowStyles.ToXml(pStrm);
+ s_aTableColStyles.ToXml(pStrm);
+ s_aParaStyles.ToXml(pStrm);
+ s_aTextStyles.ToXml(pStrm);
+ s_aSectionStyles.ToXml(pStrm);
+ s_aPageMasters.ToXml(pStrm);
+ s_aRubyStyles.ToXml(pStrm);
+ //graphics:
+ s_aGraphicsStyles.ToXml(pStrm);
+
+ pStrm->EndElement( "office:automatic-styles" );
+
+ //master:styles
+ pAttrList->Clear();
+ pStrm->StartElement( "office:master-styles" );
+ //masters pages:
+ s_aMasterpages.ToXml(pStrm);
+
+ pStrm->EndElement( "office:master-styles" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
new file mode 100644
index 000000000..47148729c
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table object.
+ ************************************************************************/
+#include <xfilter/xftable.hxx>
+#include <xfilter/xfrow.hxx>
+#include <xfilter/xfcolstyle.hxx>
+#include <xfilter/xfstylemanager.hxx>
+#include <xfilter/xfglobal.hxx>
+#include <cassert>
+
+XFTable::XFTable()
+{
+ m_strName = XFGlobal::GenTableName();
+ m_bSubTable = false;
+ m_pOwnerCell = nullptr;
+}
+
+XFTable::~XFTable()
+{
+ m_aRows.clear();
+ m_aColumns.clear();
+}
+
+void XFTable::SetColumnStyle(sal_Int32 col, const OUString& style)
+{
+ m_aColumns[col] = style;
+}
+
+void XFTable::AddRow(rtl::Reference<XFRow> const & rRow)
+{
+ assert(rRow);
+
+ for (sal_Int32 i = 0; i < rRow->GetCellCount(); ++i)
+ {
+ XFCell* pFirstCell = rRow->GetCell(i + 1); //starts at 1, not 0
+ if (pFirstCell->GetSubTable() == this)
+ throw std::runtime_error("table is a subtable of itself");
+ }
+
+ int row = rRow->GetRow();
+
+ if( row<1 )
+ rRow->SetRow(m_aRows.size()+1);
+
+ row = rRow->GetRow();
+
+ rRow->SetOwnerTable(this);
+ m_aRows[row] = rRow;
+}
+
+void XFTable::AddHeaderRow(XFRow *pRow)
+{
+ if( !pRow)
+ return;
+ if (!m_aHeaderRows.is())
+ return;
+ m_aHeaderRows->Add(pRow);
+}
+
+OUString XFTable::GetTableName()
+{
+ if( m_bSubTable )
+ {
+ return m_pOwnerCell->GetCellName();
+ }
+ else
+ return m_strName;
+}
+
+sal_uInt16 XFTable::GetRowCount()
+{
+ sal_uInt16 rowMax = 0;
+ for (auto const& row : m_aRows)
+ {
+ if (row.first > rowMax)
+ rowMax = row.first;
+ }
+
+ return rowMax;
+}
+
+XFRow* XFTable::GetRow(sal_Int32 row)
+{
+ return m_aRows[row].get();
+}
+
+sal_Int32 XFTable::GetColumnCount()
+{
+ int colMax = -1;
+ for (auto const& column : m_aColumns)
+ {
+ if( column.first>colMax )
+ colMax = column.first;
+ }
+ return colMax;
+}
+
+enumXFContent XFTable::GetContentType()
+{
+ return enumXFContentTable;
+}
+
+void XFTable::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ //sub table shouldn't use table name.
+ if( !m_bSubTable )
+ pAttrList->AddAttribute( "table:name", m_strName);
+
+ if( !GetStyleName().isEmpty() )
+ pAttrList->AddAttribute( "table:style-name", GetStyleName() );
+
+ if( m_bSubTable )
+ pStrm->StartElement( "table:sub-table" );
+ else
+ pStrm->StartElement( "table:table" );
+
+ //output columns:
+ {
+ int lastCol = 0;
+ for (auto const& column : m_aColumns)
+ {
+ sal_Int32 col = column.first;
+ OUString style = m_aColumns[col];
+
+ //default col repeated:
+ if( col >lastCol+1 )
+ {
+ if( col > lastCol + 2 )
+ {
+ if( !m_strDefColStyle.isEmpty() )
+ {
+ pAttrList->AddAttribute( "table:style-name", m_strDefColStyle );
+ }
+ pAttrList->AddAttribute( "table:number-columns-repeated", OUString::number(col-lastCol-1) );
+ }
+ pStrm->StartElement( "table:table-column" );
+ pStrm->EndElement( "table:table-column" );
+ }
+
+ if( !style.isEmpty() )
+ {
+ pAttrList->AddAttribute( "table:style-name", style );
+ }
+ pStrm->StartElement( "table:table-column" );
+ pStrm->EndElement( "table:table-column" );
+ lastCol = col;
+ }
+ }
+
+ if (m_aHeaderRows.is() && m_aHeaderRows->GetCount()>0)
+ {
+ pStrm->StartElement( "table:table-header-rows" );
+ m_aHeaderRows->ToXml(pStrm);
+ pStrm->EndElement( "table:table-header-rows" );
+ }
+ //output rows:
+ {
+ int lastRow = 0;
+
+ for (auto const& elem : m_aRows)
+ {
+ int row = elem.first;
+ XFRow *pRow = elem.second.get();
+
+ //null row repeated:
+ if( row>lastRow+1 )
+ {
+ XFRow *pNullRow = new XFRow();
+ pNullRow->SetStyleName(m_strDefRowStyle);
+ if( row>lastRow+2)
+ pNullRow->SetRepeated(row-lastRow-1);
+ rtl::Reference<XFCell> xCell(new XFCell);
+ xCell->SetStyleName(m_strDefCellStyle);
+ pNullRow->AddCell(xCell);
+ pNullRow->ToXml(pStrm);
+ }
+ pRow->ToXml(pStrm);
+ lastRow = row;
+ }
+ }
+
+ if( m_bSubTable )
+ pStrm->EndElement( "table:sub-table" );
+ else
+ pStrm->EndElement( "table:table" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftablestyle.cxx b/lotuswordpro/source/filter/xfilter/xftablestyle.cxx
new file mode 100644
index 000000000..cf1229f59
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftablestyle.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Table style.
+ ************************************************************************/
+#include <xfilter/xftablestyle.hxx>
+#include <xfilter/xfbgimage.hxx>
+
+XFTableStyle::XFTableStyle()
+ : m_fWidth(2)
+ , m_eAlign(enumXFAlignStart)
+{}
+
+XFTableStyle::~XFTableStyle()
+{
+}
+
+void XFTableStyle::SetBackImage(std::unique_ptr<XFBGImage>& rImage)
+{
+ m_pBGImage = std::move(rImage);
+}
+
+enumXFStyle XFTableStyle::GetStyleFamily()
+{
+ return enumXFStyleTable;
+}
+
+void XFTableStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+ pAttrList->AddAttribute( "style:family", "table" );
+ pStrm->StartElement( "style:style" );
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:width", OUString::number(m_fWidth) + "cm" );
+ //text align:
+ if( m_eAlign == enumXFAlignStart )
+ {
+ pAttrList->AddAttribute("table:align","left");
+ }
+ else if( m_eAlign == enumXFAlignCenter )
+ {
+ pAttrList->AddAttribute("table:align","center");
+ }
+ else if( m_eAlign == enumXFAlignEnd )
+ {
+ pAttrList->AddAttribute("table:align","right");
+ }
+ else if( m_eAlign == enumXFALignMargins )
+ {
+ pAttrList->AddAttribute("table:align","margins");
+ }
+ //background color:
+ if( m_aBackColor.IsValid() && !m_pBGImage )
+ pAttrList->AddAttribute("fo:background-color", m_aBackColor.ToString() );
+ //shadow:
+ m_aShadow.ToXml(pStrm);
+ //margin:
+ m_aMargins.ToXml(pStrm);
+ //breaks:
+ m_aBreaks.ToXml(pStrm);
+
+ pStrm->StartElement( "style:properties" );
+ if( m_pBGImage )
+ m_pBGImage->ToXml(pStrm);
+
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftabstyle.cxx b/lotuswordpro/source/filter/xfilter/xftabstyle.cxx
new file mode 100644
index 000000000..c86d6420f
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftabstyle.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tab style for paragraph.include tab offset and tab char properties.
+ ************************************************************************/
+#include "xftabstyle.hxx"
+#include <xfilter/ixfattrlist.hxx>
+
+XFTabStyle::XFTabStyle()
+ : m_eType(enumXFTabNone)
+ , m_fLength(0)
+{}
+
+void XFTabStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+
+ pAttrList->AddAttribute( "style:position", OUString::number(m_fLength) + "cm" );
+ switch(m_eType)
+ {
+ case enumXFTabLeft:
+ pAttrList->AddAttribute( "style:type", "left" );
+ break;
+ case enumXFTabCenter:
+ pAttrList->AddAttribute( "style:type", "center" );
+ break;
+ case enumXFTabRight:
+ pAttrList->AddAttribute( "style:type", "right" );
+ break;
+ case enumXFTabChar:
+ pAttrList->AddAttribute( "style:type", "char" );
+ break;
+ default:
+ break;
+ }
+ //delimiter:
+ if( m_eType == enumXFTabChar )
+ pAttrList->AddAttribute( "style:char", m_strDelimiter );
+ //leader char:
+ if( !m_strLeader.isEmpty() )
+ pAttrList->AddAttribute( "style:leader-char", m_strLeader );
+
+ pStrm->StartElement( "style:tab-stop" );
+ pStrm->EndElement( "style:tab-stop" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftabstyle.hxx b/lotuswordpro/source/filter/xfilter/xftabstyle.hxx
new file mode 100644
index 000000000..4b455268e
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftabstyle.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Tab style for paragraph.include tab offset and tab char properties.
+ ************************************************************************/
+#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFTABSTYLE_HXX
+#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFTABSTYLE_HXX
+
+#include <xfilter/xfstyle.hxx>
+
+class XFTabStyle : public XFStyle
+{
+public:
+ XFTabStyle();
+
+public:
+ void SetTabType(enumXFTab type);
+
+ void SetLength(double len);
+
+ void SetDelimiter(sal_Unicode delimiter);
+
+ void SetLeaderChar(sal_Unicode leader);
+
+ virtual void ToXml(IXFStream *pStrm) override;
+
+private:
+ enumXFTab m_eType;
+ double m_fLength;
+ OUString m_strDelimiter;
+ OUString m_strLeader;
+};
+
+inline void XFTabStyle::SetTabType(enumXFTab type)
+{
+ m_eType = type;
+}
+
+inline void XFTabStyle::SetLength(double len)
+{
+ m_fLength = len;
+}
+
+inline void XFTabStyle::SetDelimiter(sal_Unicode delimiter)
+{
+ sal_Unicode chs[2];
+ chs[0] = delimiter;
+ chs[1] = 0;
+
+ m_strDelimiter = OUString(chs);
+}
+
+inline void XFTabStyle::SetLeaderChar(sal_Unicode leader)
+{
+ sal_Unicode chs[2];
+ chs[0] = leader;
+ chs[1] = 0;
+
+ m_strLeader = OUString(chs);
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx b/lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx
new file mode 100644
index 000000000..eed8df943
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xftextboxstyle.hxx>
+#include <xfilter/xfcolumns.hxx>
+#include <xfilter/xfborders.hxx>
+#include <xfilter/xfshadow.hxx>
+#include <xfilter/xfbgimage.hxx>
+
+XFTextBoxStyle::XFTextBoxStyle()
+{
+}
+
+XFTextBoxStyle::~XFTextBoxStyle()
+{
+}
+
+enumXFStyle XFTextBoxStyle::GetStyleFamily()
+{
+ return enumXFStyleGraphics;
+}
+
+void XFTextBoxStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+ pAttrList->AddAttribute( "style:family", "graphics" );
+ //parent style name ignore now.
+ pStrm->StartElement( "style:style" );
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "draw:stroke", "none" );
+ pAttrList->AddAttribute( "svg:stroke-color", "#000000" );
+ pAttrList->AddAttribute( "draw:fill", "none" );
+ pAttrList->AddAttribute( "draw:fill-color", "#ffffff" );
+ pAttrList->AddAttribute( "draw:auto-grow-height", "true" );
+ pAttrList->AddAttribute( "style:run-through", "foreground" );
+ pAttrList->AddAttribute( "style:wrap", "run-through" );
+ pAttrList->AddAttribute( "style:wrap", "run-through" );
+ pAttrList->AddAttribute( "style:number-wrapped-paragraphs", "no-limit" );
+ pAttrList->AddAttribute( "style:wrap-contour", "false" );
+
+ pStrm->StartElement( "style:properties" );
+ pStrm->EndElement( "style:properties" );
+
+ pStrm->EndElement( "style:style" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftextcontent.cxx b/lotuswordpro/source/filter/xfilter/xftextcontent.cxx
new file mode 100644
index 000000000..945b24114
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftextcontent.cxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <xfilter/xftextcontent.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+
+XFTextContent::XFTextContent(const OUString& text):m_strText(text)
+{
+}
+
+XFTextContent::~XFTextContent()
+{
+}
+
+enumXFContent XFTextContent::GetContentType()
+{
+ return enumXFContentText;
+}
+
+void XFTextContent::SetText(const OUString& text)
+{
+ m_strText = text;
+}
+
+void XFTextContent::ToXml(IXFStream *pStrm)
+{
+// pStrm->Characters(m_strText);
+ OUString sSubString;
+ sal_Int32 nIndex = 0;
+ sal_Int32 nSize = m_strText.getLength();
+ sal_Int32 i,j;
+ for (i=0; i<nSize;)
+ {
+ sSubString = m_strText.copy(i,nSize-i);
+ nIndex = sSubString.indexOf(" ");
+ if (nIndex == -1)
+ {
+ pStrm->Characters(sSubString);
+ return;
+ }
+ else
+ {
+ if (nIndex != 0)
+ pStrm->Characters(sSubString.copy(0,nIndex));
+ for (j=nIndex+1;j<nSize-i;j++)
+ {
+ if (sSubString[j] != ' ')
+ break;
+ }
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "text:c", OUString::number(j-nIndex) );
+ pStrm->StartElement( "text:s" );
+ pStrm->EndElement( "text:s" );
+
+ i+=j;
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftextspan.cxx b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
new file mode 100644
index 000000000..14a6874c2
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * An span of text with style.
+ ************************************************************************/
+#include <xfilter/xftextspan.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/xftextcontent.hxx>
+
+XFTextSpan::XFTextSpan()
+{
+
+}
+
+XFTextSpan::XFTextSpan(const OUString& text,
+ const OUString& style
+ )
+{
+ Add(text);
+ SetStyleName(style);
+}
+
+XFTextSpan::~XFTextSpan()
+{
+}
+
+enumXFContent XFTextSpan::GetContentType()
+{
+ return enumXFContentSpan;
+}
+
+void XFTextSpan::Add(XFContent *pContent)
+{
+ m_aContents.emplace_back(pContent);
+}
+
+void XFTextSpan::Add(const OUString& text)
+{
+ XFContent *pText = new XFTextContent(text);
+ Add(pText);
+}
+
+void XFTextSpan::ToXml(IXFStream *pStrm)
+{
+ OUString style = GetStyleName();
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ assert(pAttrList);
+
+ pAttrList->Clear();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+ pStrm->StartElement( "text:span" );
+
+ for (auto const& content : m_aContents)
+ {
+ XFContent *pContent = content.get();
+ if( pContent )
+ pContent->DoToXml(pStrm);
+ }
+
+ pStrm->EndElement( "text:span" );
+}
+
+void XFTextSpanStart::ToXml(IXFStream *pStrm)
+{
+ OUString style = GetStyleName();
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ assert(pAttrList);
+
+ pAttrList->Clear();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute( "text:style-name", GetStyleName() );
+ pStrm->StartElement( "text:span" );
+
+ for (auto const& content : m_aContents)
+ {
+ XFContent *pContent = content.get();
+ if( pContent )
+ pContent->DoToXml(pStrm);
+ }
+}
+void XFTextSpanEnd::ToXml(IXFStream *pStrm)
+{
+ for (auto const& content : m_aContents)
+ {
+ XFContent *pContent = content.get();
+ if( pContent )
+ pContent->DoToXml(pStrm);
+ }
+ pStrm->EndElement( "text:span" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftextstyle.cxx b/lotuswordpro/source/filter/xfilter/xftextstyle.cxx
new file mode 100644
index 000000000..85b79a980
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftextstyle.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Style for <text:p> or <text:h> or <text:span>
+ * Now we have only font attributes.
+ ************************************************************************/
+#include <xfilter/xftextstyle.hxx>
+#include <xfilter/ixfattrlist.hxx>
+#include <xfilter/ixfstream.hxx>
+#include <xfilter/xffont.hxx>
+#include <xfilter/xfutil.hxx>
+
+XFTextStyle::XFTextStyle()
+{
+}
+
+XFTextStyle::~XFTextStyle()
+{
+}
+
+void XFTextStyle::SetFont(rtl::Reference<XFFont> const & font)
+{
+ m_pFont = font;
+}
+
+bool XFTextStyle::Equal(IXFStyle *pStyle)
+{
+ if( !pStyle || pStyle->GetStyleFamily() != enumXFStyleText )
+ {
+ return false;
+ }
+
+ XFTextStyle *pOther = dynamic_cast<XFTextStyle*>(pStyle);
+ if( !pOther )
+ {
+ return false;
+ }
+
+ if( m_pFont.is() )
+ {
+ if( !pOther->m_pFont.is() )
+ return false;
+ if( *m_pFont != *pOther->m_pFont )
+ return false;
+ }
+ else if( pOther->m_pFont.is() )
+ return false;
+
+ return true;
+}
+
+enumXFStyle XFTextStyle::GetStyleFamily()
+{
+ return enumXFStyleText;
+}
+
+void XFTextStyle::ToXml(IXFStream *strm)
+{
+ IXFAttrList *pAttrList = strm->GetAttrList();
+ OUString style = GetStyleName();
+
+ pAttrList->Clear();
+ if( !style.isEmpty() )
+ pAttrList->AddAttribute("style:name", GetStyleName());
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name", GetParentStyleName());
+
+ pAttrList->AddAttribute("style:family", "text" );
+ strm->StartElement("style:style");
+
+ //Font properties:
+ pAttrList->Clear();
+ //font name:
+ if( m_pFont.is() )
+ m_pFont->ToXml(strm);
+
+ strm->StartElement("style:properties");
+ strm->EndElement("style:properties");
+
+ strm->EndElement("style:style");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xftimestyle.cxx b/lotuswordpro/source/filter/xfilter/xftimestyle.cxx
new file mode 100644
index 000000000..95a8e7acb
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xftimestyle.cxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Time style. The Time format for time field.
+ ************************************************************************/
+
+#include <xfilter/xftimestyle.hxx>
+#include <xfilter/ixfattrlist.hxx>
+
+XFTimePart::XFTimePart()
+{
+ m_nDecimalPos = 0;
+}
+
+void XFTimePart::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ switch(m_ePart)
+ {
+ case enumXFDateHour:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:hours" );
+ pStrm->EndElement( "number:hours" );
+ break;
+ case enumXFDateMinute:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ if( m_nDecimalPos>0 )
+ pAttrList->AddAttribute( "number:decimal-places", OUString::number(m_nDecimalPos) );
+
+ pStrm->StartElement( "number:minutes" );
+ pStrm->EndElement( "number:minutes" );
+ break;
+ case enumXFDateSecond:
+ pAttrList->Clear();
+ if( m_bLongFmt )
+ pAttrList->AddAttribute( "number:style", "long" );
+ pStrm->StartElement( "number:seconds" );
+ pStrm->EndElement( "number:seconds" );
+ break;
+ case enumXFDateText:
+ pAttrList->Clear();
+ pStrm->StartElement( "number:text" );
+ pStrm->Characters( m_strText );
+ pStrm->EndElement( "number:text" );
+ break;
+ default:
+ break;
+ }
+}
+
+XFTimeStyle::XFTimeStyle()
+{
+ m_bAmPm = false;
+ m_bTruncate = true;
+}
+
+XFTimeStyle::~XFTimeStyle()
+{
+}
+
+enumXFStyle XFTimeStyle::GetStyleFamily()
+{
+ return enumXFStyleTime;
+}
+
+void XFTimeStyle::ToXml(IXFStream *pStrm)
+{
+ IXFAttrList *pAttrList = pStrm->GetAttrList();
+
+ pAttrList->Clear();
+ pAttrList->AddAttribute( "style:name", GetStyleName() );
+ if( !GetParentStyleName().isEmpty() )
+ pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
+ pAttrList->AddAttribute( "style:family", "data-style" );
+ if (!m_bTruncate)
+ pAttrList->AddAttribute( "number:truncate-on-overflow", "false" );
+ pStrm->StartElement( "number:time-style" );
+
+ for (auto & part : m_aParts)
+ {
+ part.ToXml(pStrm);
+ }
+ if( m_bAmPm )
+ {
+ pAttrList->Clear();
+ pStrm->StartElement( "number:am-pm" );
+ pStrm->EndElement( "number:am-pm" );
+ }
+ pStrm->EndElement( "number:time-style" );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfutil.cxx b/lotuswordpro/source/filter/xfilter/xfutil.cxx
new file mode 100644
index 000000000..bb21be1f0
--- /dev/null
+++ b/lotuswordpro/source/filter/xfilter/xfutil.cxx
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: IBM Corporation
+ *
+ * Copyright: 2008 by IBM Corporation
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/*************************************************************************
+ * @file
+ * Util functions for xml filter.
+ ************************************************************************/
+#include <xfilter/xfutil.hxx>
+#include <xfilter/xfparagraph.hxx>
+#include <xfilter/xfcontentcontainer.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sstream>
+
+OUString GetTableColName(sal_Int32 col)
+{
+ int remain = 0;
+ char ch;
+ std::string strOut;
+
+ if( col <= 26 )
+ {
+ ch = 'A' + col -1;
+ strOut += ch;
+ return OUString::createFromAscii(strOut.c_str());
+ }
+
+ while( col>26 )
+ {
+ remain = col%26;
+ col = col/26;
+ ch = 'A' + remain -1;
+ strOut += ch;
+ }
+
+ ch = 'A' + remain -1;
+ strOut += ch;
+ return OUString::createFromAscii(strOut.c_str());
+}
+
+//tool functions:
+OUString GetUnderlineName(enumXFUnderline type)
+{
+ switch(type)
+ {
+ case enumXFUnderlineNone:
+ return "none";
+ break;
+ case enumXFUnderlineSingle:
+ return "single";
+ break;
+ case enumXFUnderlineDouble:
+ return "double";
+ break;
+ case enumXFUnderlineDotted:
+ return "dotted";
+ break;
+ case enumXFUnderlineDash:
+ return "dash";
+ break;
+ case enumXFUnderlineLongDash:
+ return "long-dash";
+ break;
+ case enumXFUnderlineDotDash:
+ return "dot-dash";
+ break;
+ case enumXFUnderlineDotDotDash:
+ return "dot-dot-dash";
+ break;
+ case enumXFUnderlineWave:
+ return "wave";
+ break;
+ case enumXFUnderlineBold:
+ return "bold";
+ break;
+ case enumXFUnderlineBoldDotted:
+ return "bold-dotted";
+ break;
+ case enumXFUnderlineBoldDash:
+ return "bold-dash";
+ break;
+ case enumXFUnderlineBoldLongDash:
+ return "bold-long-dash";
+ break;
+ case enumXFUnderlineBoldDotDash:
+ return "bold-dot-dash";
+ break;
+ case enumXFUnderlineBoldDotDotDash:
+ return "bold-dot-dot-dash";
+ break;
+ case enumXFUnderlineBoldWave:
+ return "bold-wave";
+ break;
+ case enumXFUnderlineDoubleWave:
+ return "double-wave";
+ break;
+ case enumXFUnderlineSmallWave:
+ return "small-wave";
+ break;
+ }
+ return OUString();
+}
+
+OUString GetCrossoutName(enumXFCrossout type)
+{
+ switch(type)
+ {
+ case enumXFCrossoutSignel:
+ return "single-line";
+ break;
+ case enumXFCrossoutDouble:
+ return "double-line";
+ break;
+ case enumXFCrossoutThick:
+ return "thick-line";
+ break;
+ case enumXFCrossoutSlash:
+ return "slash";
+ break;
+ case enumXFCrossoutX:
+ return "X";
+ break;
+ default:
+ break;
+ }
+ return OUString();
+}
+
+OUString GetTransformName(enumXFTransform type)
+{
+ switch(type) {
+ case enumXFTransformUpper:
+ return "uppercase";
+ break;
+ case enumXFTransformLower:
+ return "lowercase";
+ break;
+ case enumXFTransformCapitalize:
+ return "capitalize";
+ break;
+ case enumXFTransformSmallCaps:
+ return "small-caps";
+ break;
+ default:
+ break;
+ }
+ return OUString();
+}
+
+OUString GetTextDirName(enumXFTextDir dir)
+{
+ switch(dir)
+ {
+ case enumXFTextDirLR:
+ return "lr";
+ break;
+ case enumXFTextDirLR_TB:
+ return "lr-tb";
+ break;
+ case enumXFTextDirPage:
+ return "page";
+ break;
+ case enumXFTextDirRL:
+ return "rl";
+ break;
+ case enumXFTextDirRL_TB:
+ return "rl-tb";
+ break;
+ case enumXFTextDirTB:
+ return "tb";
+ break;
+ case enumXFTextDirTB_LR:
+ return "tb-lr";
+ break;
+ case enumXFTextDirTB_RL:
+ return "tb-rl";
+ break;
+ default:
+ break;
+ }
+ return OUString();
+}
+
+OUString GetFrameXPos(enumXFFrameXPos pos)
+{
+ switch(pos)
+ {
+ case enumXFFrameXPosLeft:
+ return "left";
+ break;
+ case enumXFFrameXPosRight:
+ return "right";
+ break;
+ case enumXFFrameXPosCenter:
+ return "center";
+ break;
+ case enumXFFrameXPosFromLeft:
+ return "from-left";
+ break;
+ default:
+ break;
+ }
+ return OUString();
+}
+
+OUString GetFrameXRel(enumXFFrameXRel rel)
+{
+ switch(rel)
+ {
+ case enumXFFrameXRelPage:
+ return "page";
+ break;
+ case enumXFFrameXRelPageContent:
+ return "page-content";
+ break;
+ case enumXFFrameXRelPageEndMargin:
+ return "page-end-margin";
+ break;
+ case enumXFFrameXRelPageStartMargin:
+ return "page-start-margin";
+ break;
+ case enumXFFrameXRelPara:
+ return "paragraph";
+ break;
+ case enumXFFrameXRelParaContent:
+ return "paragraph-content";
+ break;
+ case enumXFFrameXRelParaEndMargin:
+ return "paragraph-end-margin";
+ break;
+ case enumXFFrameXRelParaStartMargin:
+ return "paragraph-start-margin";
+ break;
+ case enumXFFrameXRelChar:
+ return "char";
+ break;
+ case enumXFFrameXRelFrame:
+ return "frame";
+ break;
+ case enumXFFrameXRelFrameContent:
+ return "frame-content";
+ break;
+ case enumXFFrameXRelFrameEndMargin:
+ return "frame-end-margin";
+ break;
+ case enumXFFrameXRelFrameStartMargin:
+ return "frame-start-margin";
+ break;
+ default:
+ break;
+ }
+ return OUString();
+}
+
+OUString GetFrameYPos(enumXFFrameYPos pos)
+{
+ switch(pos)
+ {
+ case enumXFFrameYPosTop:
+ return "top";
+ case enumXFFrameYPosMiddle:
+ return "middle";
+ case enumXFFrameYPosBottom:
+ return "bottom";
+ case enumXFFrameYPosFromTop:
+ return "from-top";
+ case enumXFFrameYPosBelow:
+ return "below";
+ }
+ return OUString();
+}
+
+OUString GetFrameYRel(enumXFFrameYRel rel)
+{
+ switch(rel)
+ {
+ case enumXFFrameYRelBaseLine:
+ return "baseline";
+ case enumXFFrameYRelChar:
+ return "char";
+ case enumXFFrameYRelFrame:
+ return "frame";
+ case enumXFFrameYRelFrameContent:
+ return "frame-content";
+ case enumXFFrameYRelLine:
+ return "line";
+ case enumXFFrameYRelPage:
+ return "page";
+ case enumXFFrameYRelPageContent:
+ return "page-content";
+ case enumXFFrameYRelPara:
+ return "paragraph";
+ case enumXFFrameYRelParaContent:
+ return "paragraph-content";
+ case enumXFFrameYRelText:
+ return "text";
+ }
+ return OUString();
+}
+
+OUString GetAlignName(enumXFAlignType align)
+{
+ if( align == enumXFAlignStart )
+ return "start";
+ else if( align == enumXFAlignCenter )
+ return "center";
+ else if( align == enumXFAlignEnd )
+ return "end";
+ else if( align == enumXFAlignJustify )
+ return "justify";
+ else if( align == enumXFAlignBottom )
+ return "bottom";
+ else if( align == enumXFAlignTop )
+ return "top";
+ else if( align == enumXFAlignMiddle )
+ return "middle";
+ else if( align == enumXFALignMargins )
+ return "margins";
+
+ return OUString();
+}
+
+OUString GetPageUsageName(enumXFPageUsage usage)
+{
+ OUString sRet;
+ switch(usage)
+ {
+ case enumXFPageUsageAll:
+ sRet = "all";
+ break;
+ case enumXFPageUsageLeft:
+ sRet = "left";
+ break;
+ case enumXFPageUsageRight:
+ sRet = "right";
+ break;
+ case enumXFPageUsageMirror:
+ sRet = "mirrored";
+ break;
+ default:
+ sRet = "mirrored";
+ break;
+ }
+ return sRet;
+}
+
+OUString GetValueType(enumXFValueType type)
+{
+ OUString sRet;
+ switch(type)
+ {
+ case enumXFValueTypeBoolean:
+ sRet = "boolean";
+ break;
+ case enumXFValueTypeCurrency:
+ sRet = "currency";
+ break;
+ case enumXFValueTypeDate:
+ sRet = "date";
+ break;
+ case enumXFValueTypeFloat:
+ sRet = "float";
+ break;
+ case enumXFValueTypePercentage:
+ sRet = "percentage";
+ break;
+ case enumXFValueTypeString:
+ sRet = "string";
+ break;
+ case enumXFValueTypeTime:
+ sRet = "time";
+ break;
+ default:
+ sRet = "mirrored";
+ break;
+ }
+ return sRet;
+}
+
+OUString GetColorMode(enumXFColorMode mode)
+{
+ switch(mode)
+ {
+ case enumXFColorStandard:
+ return "standard";
+ case enumXFColorGreyscale:
+ return "greyscale";
+ case enumXFColorWatermark:
+ return "watermark";
+ case enumXFColorMono:
+ return "mono";
+ }
+ return OUString();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/util/lwpfilter.component b/lotuswordpro/util/lwpfilter.component
new file mode 100644
index 000000000..b4424048a
--- /dev/null
+++ b/lotuswordpro/util/lwpfilter.component
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Writer.LotusWordProImportFilter"
+ constructor="LotusWordProImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+</component>